Skip to content

Commit b4d4d8e

Browse files
committed
wslpath2winpath: note that path must exist
1 parent 672f682 commit b4d4d8e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

+stdlib/wslpath2winpath.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
function win_path = wslpath2winpath(wsl_path)
22
%% wslpath2winpath(wsl_path)
33
% Convert a WSL path to a Windows path
4+
% PATH MUST EXIST IN WSL
45
% output format is like \\wsl$\Ubuntu\home\username\...
56
arguments (Input)
67
wsl_path (1,1) string {mustBeNonzeroLengthText}

test/TestWSL.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ function test_wsl_path(tc)
4949
wsl_temp = stdlib.sys.wsl_tempfile();
5050
tc.verifyNotEmpty(wsl_temp, "could not get WSL tempfile")
5151

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

5557
win_path = stdlib.winpath2wslpath(wsl_path);

0 commit comments

Comments
 (0)