Base: fixes #6802: Raise an exception when using FileInfo::toStdWString() for other platforms than Windows

This commit is contained in:
wmayer
2022-05-09 14:21:10 +02:00
parent e1f497cf76
commit 37611d6e02
2 changed files with 5 additions and 8 deletions

View File

@@ -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
}