pfs_fix_path.m (pfstools-2.1.0.tgz) | : | pfs_fix_path.m (pfstools-2.2.0.tgz) | ||
---|---|---|---|---|
function [fixed_path, cygwin_home] = pfs_fix_path( path ) | function [fixed_path, cygwin_home] = pfs_fix_path( path ) | |||
% Used to fix paths when running cygwin on Windows. This is an internal | % Used to fix paths when running cygwin on Windows. This is an internal | |||
% command. Do not use. | % command. Do not use. | |||
if ~ispc() | if ~ispc() | |||
fixed_path = path; | fixed_path = path; | |||
else | else | |||
[pstatus, tmp] = dos('set CYGWIN_HOME'); | pstatus = dos('set CYGWIN_HOME > nul 2>&1'); | |||
if(pstatus == 1) | if(pstatus == 1) | |||
cygwin_home = 'c:\\cygwin'; | check_dirs = { 'c:\\cygwin', 'c:\\cygwin64', 'c:\\cygwin32' }; | |||
cygwin_home = []; | ||||
for kk=1:length(check_dirs) | ||||
if exist( check_dirs{kk}, 'dir' ) | ||||
cygwin_home = check_dirs{kk}; | ||||
break; | ||||
end | ||||
end | ||||
if isempty( cygwin_home ) | ||||
error( 'Cannot find Cygwin home directory. Set CYGWIN_HOME environme | ||||
nt variable.' ); | ||||
end | ||||
else | else | |||
[pstatus, cygwin_home] = dos('echo %CYGWIN_HOME%'); | [pstatus, cygwin_home] = dos('echo %CYGWIN_HOME%'); | |||
cygwin_home = strtrim(cygwin_home); % to remove the final LF | cygwin_home = strtrim(cygwin_home); % to remove the final LF | |||
end | end | |||
[pstatus, fixed_path] = dos( [ fullfile( cygwin_home, 'bin', 'cygpath' ) ' ' path] ); | [pstatus, fixed_path] = dos( [ fullfile( cygwin_home, 'bin', 'cygpath' ) ' ' path] ); | |||
fixed_path = strtrim( fixed_path ); | fixed_path = strtrim( fixed_path ); | |||
end | end | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 13 lines changed or added |