# HG changeset patch # User Rik # Date 1441221588 25200 # Node ID 0829b6ff3ac9132d05c9786b534c09b05982a30b # Parent caa5de39147e296f545359d7a2ddcc3fae4e17d3 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. diff -r caa5de39147e -r 0829b6ff3ac9 liboctave/system/file-ops.cc --- 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 +#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);