1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-22 14:56:36 +00:00

Cleverer filesystem path conversion for QString/QStringView

This commit is contained in:
Alexei Kotov 2025-10-18 02:57:36 +03:00
parent 0bae2b14b1
commit b7ddc8304b

View file

@ -18,12 +18,10 @@ QString Files::pathToQString(std::filesystem::path&& path)
std::filesystem::path Files::pathFromQString(QStringView path)
{
const QByteArray tmp = path.toUtf8();
return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size())));
return std::filesystem::path(std::u16string_view(path.utf16(), path.size()));
}
std::filesystem::path Files::pathFromQString(QString&& path)
{
const QByteArray tmp = path.toUtf8();
return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size())));
return std::filesystem::path(path.toStdU16String());
}