App: correctly handle UTF-8 encoded path names under Windows

This commit is contained in:
wmayer
2021-09-29 13:47:29 +02:00
parent b7ea205c70
commit ca05fc678b

View File

@@ -2613,7 +2613,12 @@ bool Document::saveToFile(const char* filename) const
}
Base::FileInfo tmp(fn);
// In case some folders in the path do not exist
#ifdef FC_OS_WIN32
QString utf8Name = QString::fromUtf8(filename);
auto parentPath = fs::absolute(fs::path(utf8Name.toStdWString())).parent_path();
#else
auto parentPath = fs::absolute(fs::path(filename)).parent_path();
#endif
fs::create_directories(parentPath);
// open extra scope to close ZipWriter properly