Mercurial > hg > octave-jordi
changeset 20709:73800f39da6f
@ftp/mget: honor the TARGET argument
* @ftp/mget.m: call __ftp_mget__ with a third argument that defaults to ""
* @ftp/mget.m: rephrase doc for TARGET argument
* urlwrite.cc (F__ftp_mget__): add trailing dirsep only if the target argument
is not empty.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Tue, 17 Nov 2015 22:04:42 +0100 |
parents | a2a99aaf680b |
children | 7b608fadc663 |
files | libinterp/corefcn/urlwrite.cc scripts/@ftp/mget.m |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/urlwrite.cc +++ b/libinterp/corefcn/urlwrite.cc @@ -1026,7 +1026,7 @@ std::string file = args(1).xstring_value ("__ftp_mget__: PATTERN must be a string"); std::string target; - if (nargin == 3) + if (nargin == 3 && ! args(2).is_empty ()) target = args(2).xstring_value ("__ftp_mget__: TARGET must be a string") + file_ops::dir_sep_str (); string_vector sv = curl.list ();
--- a/scripts/@ftp/mget.m +++ b/scripts/@ftp/mget.m @@ -28,13 +28,13 @@ ## The arguments @var{file} and @var{dir} can include wildcards and any ## files or directories on the remote server that match will be downloaded. ## -## If a third argument @var{target} is given, then a single file or -## directory will be downloaded to the local directory and the local name -## will be changed to @var{target}. +## If a third string argument @var{target} is given, then it must indicate +## the path to the local destination directory. @var{target} may be a +## relative or absolute path. ## @end deftypefn -function mget (f, file) - __ftp_mget__ (f.curlhandle, file); +function mget (f, file, target = "") + __ftp_mget__ (f.curlhandle, file, target); endfunction