microsoft/openvmm

Public

mirrored fromhttps://github.com/microsoft/openvmmAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/apply-async-process-wait-functionality

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

flowey/flowey_lib_common/src/_util/wslpath.rs

26lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use flowey::node::prelude::RustRuntimeServices;
5use std::path::Path;
6use std::path::PathBuf;
7
8pub fn win_to_linux(rt: &RustRuntimeServices<'_>, path: impl AsRef<Path>) -> PathBuf {
9 let path = path.as_ref();
10 flowey::shell_cmd!(rt, "wslpath {path}")
11 .quiet()
12 .ignore_status()
13 .read()
14 .unwrap()
15 .into()
16}
17
18pub fn linux_to_win(rt: &RustRuntimeServices<'_>, path: impl AsRef<Path>) -> PathBuf {
19 let path = path.as_ref();
20 flowey::shell_cmd!(rt, "wslpath -aw {path}")
21 .quiet()
22 .ignore_status()
23 .read()
24 .unwrap()
25 .into()
26}
27