Mercurial > hg > octave-nkf
changeset 19425:0ded8964c13a
Added wildcard * support to archive-related routines (bug #43211).
* unpack.m: added wildcard expansion via glob() for input filename.
author | Massimiliano Fasi <massimiliano.fasi@gmail.com> |
---|---|
date | Thu, 18 Sep 2014 11:05:52 +0200 |
parents | ec10705dbd83 |
children | 6ebc2ca01c76 |
files | scripts/miscellaneous/unpack.m |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/miscellaneous/unpack.m +++ b/scripts/miscellaneous/unpack.m @@ -32,23 +32,27 @@ ## Author: Bill Denney <denney@seas.upenn.edu> -function filelist = unpack (file, dir = ".", filetype = "") +function filelist = unpack (filename, dir = ".", filetype = "") if (nargin < 1 || nargin > 3) print_usage (); endif - if (! ischar (file) && ! iscellstr (file)) - error ("unpack: invalid input file class, %s", class (file)); + if (! ischar (filename) && ! iscellstr (filename)) + error ("unpack: invalid input file class, %s", class (filename)); endif ## character arrays of more than one string must be treated as cell strings - if (ischar (file) && ! isvector (file)) - file = cellstr (file); + if (ischar (filename) && ! isvector (filename)) + file = cellstr (filename); + else + file = glob (filename); endif ## Recursively unpack cellstr arrays one file at a time - if (iscellstr (file)) + n_elem = numel (file); + if (n_elem > 1) + files = {}; for i = 1:numel (file) tmpfiles = unpack (file{i}, dir); @@ -61,6 +65,9 @@ endif return; + + else + file = filename; endif if (isdir (file)) @@ -247,5 +254,4 @@ ## Strip leading blanks and .bz2 extension from file name files = regexprep (output, '^\s+(.*)\.bz2: .*', '$1'); -endfunction - +endfunction \ No newline at end of file