Mercurial > hg > octave-lyh
diff scripts/miscellaneous/ls_command.m @ 14036:29e9eb59f917
ls_command.m: Fix incorrect listing command on MinGW (Bug #35038, Bug #35039)
* ls_command.m: Use 'dir /D' for listing command on MinGW. Add %! tests.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 12 Dec 2011 13:52:35 -0800 |
parents | 02f8f4c509ec |
children | 72c96de7a403 |
line wrap: on
line diff
--- a/scripts/miscellaneous/ls_command.m +++ b/scripts/miscellaneous/ls_command.m @@ -30,10 +30,10 @@ global __ls_command__; if (isempty (__ls_command__)) - ## FIXME -- ispc and isunix both return true for Cygwin. Should they? + ## MinGW uses different ls_command if (ispc () && ! isunix () && isempty (file_in_path (getenv ("PATH"), "ls"))) - __ls_command__ = "cmd /C dir /D"; + __ls_command__ = "dir /D"; else __ls_command__ = "ls -C"; endif @@ -54,3 +54,14 @@ endif endfunction + + +%!test +%! cmd = ls_command (); +%! assert (ischar (cmd)); +%! if (ispc () && ! isunix ()) +%! assert (cmd(1:3), "dir"); +%! else +%! assert (cmd(1:2), "ls"); +%! endif +