diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index 1d3c74aae3..46a142bb05 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -275,16 +275,12 @@ std::string FileInfo::fileNamePure () const std::wstring FileInfo::toStdWString() const { // As FileName is UTF-8 is encoded we have to convert it - // for Windows because the path names are UCS-2 encoded. + // for Windows because the path names are UTF-16 encoded. #ifdef FC_OS_WIN32 return ConvertToWideString(FileName); #else - // FIXME: For MacOS the path names are UCS-4 encoded. - // For the moment we cannot handle path names containing - // non-ASCII characters. - // For Linux the paths names are encoded in UTF-8 so we actually - // don't need this method therefore. - return std::wstring(); + // On other platforms it's discouraged to use wchar_t for file names + throw Base::FileException("Cannot use FileInfo::toStdWString() on this platform"); #endif } diff --git a/src/Base/FileInfo.h b/src/Base/FileInfo.h index 3cc02239fc..4b49173dd3 100644 --- a/src/Base/FileInfo.h +++ b/src/Base/FileInfo.h @@ -67,7 +67,8 @@ public: std::string fileName () const; /// Returns the name of the file, excluding the path and the extension. std::string fileNamePure () const; - /// Convert the path name into a UCS-2 encoded wide string format. + /// Convert the path name into a UTF-16 encoded wide string format. + /// @note: Use this function on Windows only. std::wstring toStdWString() const; /** Returns the extension of the file. * The extension consists of all characters in the file after (but not including)