Mercurial > octave
diff scripts/miscellaneous/zip.m @ 21525:50255c612915
Fix zip, gzip, bzip2 to allow names with spaces (bug #47232).
* zip.m: Expand out wildcards with glob(), escape double quotes with regexprep,
and then wrap file names in double quotes before passing to zip command via
the shell.
* __xzip__.m: Wrap file names in double quotes before passing through shell.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 22 Mar 2016 14:25:35 -0700 |
parents | 516bb87ea72e |
children | 6187f1d2ca13 |
line wrap: on
line diff
--- a/scripts/miscellaneous/zip.m Sat Mar 19 14:29:55 2016 -0400 +++ b/scripts/miscellaneous/zip.m Tue Mar 22 14:25:35 2016 -0700 @@ -55,7 +55,11 @@ zipfile = make_absolute_filename (zipfile); - cmd = sprintf ("zip -r %s %s", zipfile, sprintf (" %s", files{:})); + files = glob (files); # expand wildcards + files = regexprep (files, '"', '\\"'); # escape double quotes + files = sprintf (' "%s"', files{:}); # convert to space separated list + zipfile = regexprep (zipfile, '"', '\\"'); # escape double quotes + cmd = sprintf ('zip -r "%s" %s', zipfile, files); origdir = pwd (); cd (rootdir);