changeset 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 a8952515415d
children 4228c102eca9 024a050fc147
files scripts/miscellaneous/ls_command.m
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/ls_command.m	Sun Dec 11 23:32:01 2011 -0500
+++ b/scripts/miscellaneous/ls_command.m	Mon Dec 12 13:52:35 2011 -0800
@@ -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
+