changeset 20538:0829b6ff3ac9 stable

Use backslash as windows file separator for canonicalize_file_name (Bug #45816). * file-ops.cc (octave_canonicalize_file_name): call std::replace to change all '/' to '\' on Windows platforms.
author Rik <rik@octave.org>
date Wed, 02 Sep 2015 12:19:48 -0700
parents caa5de39147e
children 0fdba3fdf40e
files liboctave/system/file-ops.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/system/file-ops.cc	Tue Sep 22 04:47:25 2015 -0700
+++ b/liboctave/system/file-ops.cc	Wed Sep 02 12:19:48 2015 -0700
@@ -54,6 +54,10 @@
 #include "singleton-cleanup.h"
 #include "str-vec.h"
 
+#if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
+#include <algorithm>
+#endif
+
 file_ops *file_ops::instance = 0;
 
 bool
@@ -738,6 +742,11 @@
       free (tmp);
     }
 
+#if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
+  // Canonical Windows file separator is backslash.
+  std::replace (retval.begin (), retval.end (), '/', '\\');
+#endif
+
   if (retval.empty ())
     msg = gnulib::strerror (errno);