changeset 26822:670ebc29ec69

make_absolute_filename: Don't strip drive letter from path (bug #36677). * oct-env.cc (pathname_backup): Keep file letter part of path on Windows.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 03 Mar 2019 17:15:37 +0100
parents 880466837c06
children 0a383bddfb40
files liboctave/system/oct-env.cc
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/system/oct-env.cc	Sat Mar 02 23:21:13 2019 -0800
+++ b/liboctave/system/oct-env.cc	Sun Mar 03 17:15:37 2019 +0100
@@ -579,6 +579,16 @@
           while (sys::file_ops::is_dir_sep (path[i]) && i > 0)
             i--;
 
+#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
+          // Don't strip file letter part.
+          if (i == 1 && path[i] == ':')
+            {
+              // Keep path separator if present.
+              i = std::min (i+2, path.length ());
+              break;
+            }
+#endif
+
           while (! sys::file_ops::is_dir_sep (path[i]) && i > 0)
             i--;