Mercurial > octave
comparison scripts/miscellaneous/ls.m @ 30960:98bff9749345
maint: Merge stable to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 22 Apr 2022 08:55:26 +0200 |
parents | cd741166d6fb d585976cb30a |
children | b9e4d91d20ce |
comparison
equal
deleted
inserted
replaced
30958:8a8f82c0235e | 30960:98bff9749345 |
---|---|
69 if (nargin > 0) | 69 if (nargin > 0) |
70 args = tilde_expand (varargin); | 70 args = tilde_expand (varargin); |
71 | 71 |
72 if (ispc () && ! isunix ()) | 72 if (ispc () && ! isunix ()) |
73 if (strncmp (ls_cmd, "ls", 2)) | 73 if (strncmp (ls_cmd, "ls", 2)) |
74 ## Replace backslashes with forward slashes (unless they escape a glob | 74 ## Replace backslashes with forward slashes (unless they escape a |
75 ## pattern) | 75 ## wildcard character) |
76 args = regexprep (args, '\\(?![*?\[\]])', '/'); | 76 args = regexprep (args, '\\(?![*?\[\]])', '/'); |
77 ## Enclose paths, potentially having spaces, in double quotes: | 77 ## Enclose paths, potentially having spaces, in double quotes: |
78 args = strcat ('"', args, '"'); | 78 args = strcat ('"', args, '"'); |
79 ## Exclude glob patterns and escaped characters from quoted part of | 79 ## Exclude glob patterns and escaped characters from quoted part of |
80 ## FILENAMES string | 80 ## FILENAMES string |
81 args = regexprep (args, '(?<!\\)([*?])', '"$1"'); | 81 args = regexprep (args, '(?<!\\)([*?])', '"$1"'); |
82 args = regexprep (args, '(?<!\\)\[', '"['); | 82 args = regexprep (args, '(?<!\\)\[', '"['); |
83 args = regexprep (args, '(?<!\\)\[', ']"'); | 83 args = regexprep (args, '(?<!\\)\]', ']"'); |
84 args = regexprep (args, '(\\.)', '"$1"'); | 84 args = regexprep (args, '(\\.)', '"$1"'); |
85 else | 85 else |
86 idx = ! strncmp (args, '/', 1); | 86 idx = ! strncmp (args, '/', 1); |
87 ## Enclose paths, potentially having spaces, in double quotes: | 87 ## Enclose paths, potentially having spaces, in double quotes: |
88 args(idx) = strcat ('"', args(idx), '"'); | 88 args(idx) = strcat ('"', args(idx), '"'); |