# HG changeset patch # User Rik # Date 1592104370 25200 # Node ID 5a85e42a1be7b724c50dcaf7faaa2b60500e5c57 # Parent a6c89130cfaa3618db4c97c77d90457d550f22ce Make gzip/bzip2 more Matlab compatible when directory is first argument (bug #58547). * gzip.cc (xzip): Strip source path from basename of source file. diff -r a6c89130cfaa -r 5a85e42a1be7 libinterp/dldfcn/gzip.cc --- a/libinterp/dldfcn/gzip.cc Sun Jun 14 11:17:33 2020 +0200 +++ b/libinterp/dldfcn/gzip.cc Sat Jun 13 20:12:50 2020 -0700 @@ -556,7 +556,10 @@ const std::function 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); };