comparison liboctave/system/file-ops.cc @ 31216:f111d1caa73d stable

canonicalize_file_name: Trim trailing file separators from root of mapped network drive (bug #62847). * liboctave/system/file-ops.cc (canonicalize_file_name): Trim trailing file separators from root of mapped network drive before potentially replacing it in the canonicalized path.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 30 Aug 2022 18:26:30 +0200
parents 4c38cf0ce06c
children 6a5e4ef80a95
comparison
equal deleted inserted replaced
31214:19bd1953fc1d 31216:f111d1caa73d
776 if (orig_root.compare (0, 8, R"(\\?\UNC\)")) 776 if (orig_root.compare (0, 8, R"(\\?\UNC\)"))
777 // root was not a mapped share 777 // root was not a mapped share
778 return retval; 778 return retval;
779 779
780 orig_root = orig_root.erase (2, 6); 780 orig_root = orig_root.erase (2, 6);
781 // trim trailing file separators from UNC path corresponding to root
782 std::string file_seps = file_ops::dir_sep_chars ();
783 while (file_seps.find (orig_root.back ()) != std::string::npos)
784 orig_root.pop_back ();
785
781 if (retval.compare (0, orig_root.size (), orig_root)) 786 if (retval.compare (0, orig_root.size (), orig_root))
782 // start of UNC path doesn't match mapped drive root 787 // start of UNC path doesn't match mapped drive root
783 return retval; 788 return retval;
784 789
785 // file is on mapped share 790 // file is on mapped share