Mercurial > hg > octave-nkf
changeset 18171:05a53cc522b7
fix ls when spaces are present in path (bug #40989)
author | Felipe G. Nievinski <fgnievinski@gmail.com> |
---|---|
date | Wed, 25 Dec 2013 10:46:42 -0200 |
parents | 8d332da6694f |
children | 0490de623fa0 |
files | scripts/miscellaneous/ls.m |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/miscellaneous/ls.m +++ b/scripts/miscellaneous/ls.m @@ -60,7 +60,16 @@ if (nargin > 0) args = tilde_expand (varargin); - if (ispc () && ! isunix ()) + is_dos = (ispc () && ! isunix ()); + if is_dos + optsep = "/"; + else + optsep = "-"; + endif + idx = ! strncmp (args, optsep, 1); + ## Enclose paths, potentially having spaces, in double quotes: + args(idx) = strcat ("\"", args(idx), "\""); + if is_dos ## shell (cmd.exe) on MinGW uses '^' as escape character args = regexprep (args, '([^\w.*? -])', '^$1'); ## Strip UNIX directory character which looks like an option to dir cmd.