Skip to content

Commit

Permalink
wslpath2winpath: note that path must exist
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jul 9, 2024
1 parent 672f682 commit b4d4d8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions +stdlib/wslpath2winpath.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function win_path = wslpath2winpath(wsl_path)
%% wslpath2winpath(wsl_path)
% Convert a WSL path to a Windows path
% PATH MUST EXIST IN WSL
% output format is like \\wsl$\Ubuntu\home\username\...
arguments (Input)
wsl_path (1,1) string {mustBeNonzeroLengthText}
Expand Down
4 changes: 3 additions & 1 deletion test/TestWSL.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function test_wsl_path(tc)
wsl_temp = stdlib.sys.wsl_tempfile();
tc.verifyNotEmpty(wsl_temp, "could not get WSL tempfile")

wsl_path = stdlib.wslpath2winpath(wsl_temp);
wsl_path = stdlib.wslpath2winpath("~");
% can't use wsl_temp as new WSL spawned might have erased it.
tc.verifyNotEqual(wsl_path, "~")
tc.verifyTrue(stdlib.is_wsl_path(wsl_path), "could not convert WSL path to Windows path")

win_path = stdlib.winpath2wslpath(wsl_path);
Expand Down

0 comments on commit b4d4d8e

Please sign in to comment.