diff libinterp/corefcn/load-path.cc @ 24424:ceae837bc9ea stable

Fix addpath for UNC paths on Windows (bug #51268). * load-path.cc (Faddpath): Check for duplicate file separators starting from the second character in Windows.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 25 Jun 2017 18:50:44 +0200
parents 3ac9f9ecfae5
children 3e88df7cd365
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc	Thu Dec 14 22:43:16 2017 -0600
+++ b/libinterp/corefcn/load-path.cc	Sun Jun 25 18:50:44 2017 +0200
@@ -2483,7 +2483,12 @@
           std::string dir = p;
 
           // Remove duplicate directory separators
-          dir.erase (std::unique (dir.begin (), dir.end (),
+          std::string::iterator it_start = dir.begin ();
+#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
+          // In Windows, start check at second character (for UNC paths).
+          it_start++;
+#endif
+          dir.erase (std::unique (it_start, dir.end (),
                                   [](char l, char r)
                                   {
                                     return l == r &&