Mercurial > octave-nkf
comparison liboctave/system/file-ops.cc @ 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 | 4197fc428c7d |
children | 3aea4200da40 |
comparison
equal
deleted
inserted
replaced
20535:caa5de39147e | 20538:0829b6ff3ac9 |
---|---|
51 #include "oct-passwd.h" | 51 #include "oct-passwd.h" |
52 #include "pathlen.h" | 52 #include "pathlen.h" |
53 #include "quit.h" | 53 #include "quit.h" |
54 #include "singleton-cleanup.h" | 54 #include "singleton-cleanup.h" |
55 #include "str-vec.h" | 55 #include "str-vec.h" |
56 | |
57 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) | |
58 #include <algorithm> | |
59 #endif | |
56 | 60 |
57 file_ops *file_ops::instance = 0; | 61 file_ops *file_ops::instance = 0; |
58 | 62 |
59 bool | 63 bool |
60 file_ops::instance_ok (void) | 64 file_ops::instance_ok (void) |
736 { | 740 { |
737 retval = tmp; | 741 retval = tmp; |
738 free (tmp); | 742 free (tmp); |
739 } | 743 } |
740 | 744 |
745 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) | |
746 // Canonical Windows file separator is backslash. | |
747 std::replace (retval.begin (), retval.end (), '/', '\\'); | |
748 #endif | |
749 | |
741 if (retval.empty ()) | 750 if (retval.empty ()) |
742 msg = gnulib::strerror (errno); | 751 msg = gnulib::strerror (errno); |
743 | 752 |
744 return retval; | 753 return retval; |
745 } | 754 } |