changeset 31027:72786e150001 stable

oct-glob.cc: Fix yet another typo in 8475b51b990c. * dirfns.cc (glob): Add BIST.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 26 May 2022 12:58:52 +0200
parents a05f112edde4
children 509ba2cc30ec 9504d582b2c6
files libinterp/corefcn/dirfns.cc liboctave/util/oct-glob.cc
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/dirfns.cc	Wed May 25 15:11:26 2022 -0400
+++ b/libinterp/corefcn/dirfns.cc	Thu May 26 12:58:52 2022 +0200
@@ -564,6 +564,15 @@
 %! assert (result1, {"file1"; "myfile1"});
 %! assert (result2, {"myfile1"});
 %! assert (result3, {"file1"; "file2"});
+
+## Check backslash handling on Windows
+%!testif ; ispc ()
+%! win_dir = getenv ("WINDIR");
+%! assert (glob (win_dir), {win_dir});
+%! assert (glob ([win_dir, filesep]), {[win_dir, filesep]});
+%! win_dir2 = strrep(win_dir, filesep, '/');
+%! assert (glob (win_dir2), {win_dir});
+%! assert (glob ([win_dir2, '/']), {[win_dir, filesep]});
 */
 
 DEFUN (__wglob__, args, ,
--- a/liboctave/util/oct-glob.cc	Wed May 25 15:11:26 2022 -0400
+++ b/liboctave/util/oct-glob.cc	Thu May 26 12:58:52 2022 +0200
@@ -100,7 +100,7 @@
             {
 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)           \
      && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
-              std::replace (xpat.begin (), xpat.end (), '/', '\\');
+              std::replace (xpat.begin (), xpat.end (), '\\', '/');
 #endif
 
               int err = octave_glob_wrapper (xpat.c_str (),