getWSLpath Translate Windows-style path to its Unix WSL (Windows Subsystem for Linux) equivalent. Input: path string with directory of file path, in Windows-style (e.g. 'C:\Directory\') Output: path string with directory of file path, in Unix style (e.g. '/mnt/c/Directory/') Uses the WSL function 'wslpath' to translate the path. Usage: path=getWSLpath(path)
0001 function path=getWSLpath(path) 0002 % getWSLpath 0003 % Translate Windows-style path to its Unix WSL (Windows Subsystem for 0004 % Linux) equivalent. 0005 % 0006 % Input: 0007 % path string with directory of file path, in Windows-style (e.g. 0008 % 'C:\Directory\') 0009 % 0010 % Output: 0011 % path string with directory of file path, in Unix style (e.g. 0012 % '/mnt/c/Directory/') 0013 % 0014 % Uses the WSL function 'wslpath' to translate the path. 0015 % 0016 % Usage: path=getWSLpath(path) 0017 [status,path]=system(['wsl wslpath ''' path '''']); 0018 if status==-1 0019 error('Cannot get access to Windows Subsystem for Linux, check your WSL installation') 0020 end 0021 path=path(1:end-1);% Remove final character (line-break) 0022 end