Mercurial > octave
changeset 28469:4d7232bcf6c1
Make gzip/bzip2 more Matlab compatible when directory is first argument (bug #58547).
* gzip.cc (xzip): Strip source path from basename of source file.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 13 Jun 2020 20:12:50 -0700 |
parents | e5ab4194f45d |
children | a40e3c3e17fa |
files | libinterp/dldfcn/gzip.cc |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/gzip.cc Sat Jun 13 07:28:38 2020 -0700 +++ b/libinterp/dldfcn/gzip.cc Sat Jun 13 20:12:50 2020 -0700 @@ -556,7 +556,10 @@ const std::function<std::string(const std::string&)> mk_dest_path = [&out_dir, &ext] (const std::string& source_path) -> std::string { - const std::string basename = sys::env::base_pathname (source_path); + // Strip any relative path (bug #58547) + size_t pos = source_path.find_last_of (sys::file_ops::dir_sep_str ()); + const std::string basename = + (pos == std::string::npos ? source_path : source_path.substr (pos+1)); return sys::file_ops::concat (out_dir, basename + ext); };