diff --git a/+stdlib/wslpath2winpath.m b/+stdlib/wslpath2winpath.m index 5e521de..1d17fd2 100644 --- a/+stdlib/wslpath2winpath.m +++ b/+stdlib/wslpath2winpath.m @@ -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} diff --git a/test/TestWSL.m b/test/TestWSL.m index 7b7a825..e22d864 100644 --- a/test/TestWSL.m +++ b/test/TestWSL.m @@ -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);