Base: fixes #6802: Raise an exception when using FileInfo::toStdWString() for other platforms than Windows
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user