Mercurial > octave
changeset 28867:ed029f40be15 stable
Fix regression with stat for non-ASCII filenames on Windows.
* file-stat.cc (file_stat::update_internal): "canonicalize_file_name" might
return empty for file names that cannot be represented with the locale charset
on Windows. Use original "full_file_name" in this case as fallback.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 08 Oct 2020 16:06:58 +0200 |
parents | 6f842b870f3c |
children | f45b11396662 73f04ba59351 |
files | liboctave/system/file-stat.cc |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/file-stat.cc Thu Oct 08 11:49:28 2020 +0200 +++ b/liboctave/system/file-stat.cc Thu Oct 08 16:06:58 2020 +0200 @@ -194,7 +194,12 @@ std::string full_file_name = sys::file_ops::tilde_expand (file_name); #if defined (OCTAVE_USE_WINDOWS_API) - full_file_name = sys::canonicalize_file_name (full_file_name); + std::string canon_file_name + = sys::canonicalize_file_name (full_file_name); + + // Might have failed for files with non-ASCII characters in name + if (! canon_file_name.empty ()) + full_file_name = canon_file_name; // Remove trailing slashes while (full_file_name.length () > 1