comparison scripts/miscellaneous/zip.m @ 21582:fa58fcb7c51d

zip.m: Fix zipping into directory with spaces. * zip.m: Protect the zip file name when calling unzip to get list of files in archive.
author Rik <rik@octave.org>
date Fri, 01 Apr 2016 21:20:23 -0700
parents 6187f1d2ca13
children 3b9524234d89
comparison
equal deleted inserted replaced
21581:6fab85c1538f 21582:fa58fcb7c51d
71 if (status) 71 if (status)
72 error ("zip: zip failed with exit status = %d", status); 72 error ("zip: zip failed with exit status = %d", status);
73 endif 73 endif
74 74
75 if (nargout > 0) 75 if (nargout > 0)
76 cmd = ["unzip -Z -1 " zipfile]; 76 cmd = sprintf ("unzip -Z -1 '%s'", zipfile);
77 [status, filelist] = system (cmd); 77 [status, filelist] = system (cmd);
78 if (status) 78 if (status)
79 error ("zip: zipinfo failed with exit status = %d", status); 79 error ("zip: zipinfo failed with exit status = %d", status);
80 endif 80 endif
81 filelist = ostrsplit (filelist, "\r\n", true); 81 filelist = ostrsplit (filelist, "\r\n", true);