changeset 29516:9f0649b4e912

canonicalize_file_name: Add yet another work-around for non-ASCII paths on Windows (bug #60306). * liboctave/system/file-ops.cc (canonicalize_file_name): Return early with the current directory if the input is ".". This change will allow to execute files in the current working directory even if it contains characters that cannot be encoded in the system locale.
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 07 Apr 2021 20:18:21 +0200
parents 3ff059ddc7fe
children 78ccd8bf439c
files liboctave/system/file-ops.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/system/file-ops.cc	Thu Apr 08 16:04:45 2021 -0700
+++ b/liboctave/system/file-ops.cc	Wed Apr 07 20:18:21 2021 +0200
@@ -703,6 +703,11 @@
       std::string retval;
 
 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM))
+      // This is a work-around to allow running files in the current path if it
+      // contains characters that cannot be encoded in the locale charset.
+      if (name.compare (".") == 0)
+        return env::get_current_directory ();
+
       // On Windows, convert to locale charset before passing to
       // canonicalize_file_name, and convert back to UTF-8 after that.