Mercurial > octave
changeset 25624:815cfd72ddf5
Fix "rename" for files with non-ASCII chars on Windows.
* file-ops.cc (rename): Use Unicode WinAPI function on Windows.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 15 Jul 2018 19:49:19 +0200 |
parents | 331f46b9ee6c |
children | 6fb384c855c1 |
files | liboctave/system/file-ops.cc |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/file-ops.cc Sun Jul 15 15:47:49 2018 +0200 +++ b/liboctave/system/file-ops.cc Sun Jul 15 19:49:19 2018 +0200 @@ -501,13 +501,19 @@ return rename (from, to, msg); } - int rename (const std::string& from, const std::string& to, std::string& msg) + int rename (const std::string& from, const std::string& to, + std::string& msg) { int status = -1; msg = ""; +#if defined (OCTAVE_USE_WINDOWS_API) + status = _wrename (u8_to_wstring (from).c_str (), + u8_to_wstring (to).c_str ()); +#else status = std::rename (from.c_str (), to.c_str ()); +#endif if (status < 0) msg = std::strerror (errno);