diff --git a/src/mumble/CMakeLists.txt b/src/mumble/CMakeLists.txt index 4cc9fa84d9e..ffa894b32b7 100644 --- a/src/mumble/CMakeLists.txt +++ b/src/mumble/CMakeLists.txt @@ -597,6 +597,7 @@ if(WIN32) find_pkg(Boost COMPONENTS + filesystem system thread REQUIRED @@ -630,6 +631,7 @@ if(WIN32) target_link_libraries(mumble_client_object_lib PUBLIC + Boost::filesystem Boost::system Boost::thread ) diff --git a/src/mumble/PluginInstaller.cpp b/src/mumble/PluginInstaller.cpp index 4740acb0f64..e4d9229dced 100644 --- a/src/mumble/PluginInstaller.cpp +++ b/src/mumble/PluginInstaller.cpp @@ -18,9 +18,10 @@ #include #include -#include #include +#include + #include #include #include @@ -127,7 +128,8 @@ void PluginInstaller::init() { zipInput.clear(); Poco::Zip::ZipInputStream zipin(zipInput, pluginIt->second); - std::ofstream out(tmpPluginPath.toStdString(), std::ios::out | std::ios::binary); + boost::filesystem::path nativePath(tmpPluginPath.toUtf8().data()); + boost::filesystem::ofstream out(nativePath, std::ios::out | std::ios::binary); Poco::StreamCopier::copyStream(zipin, out); m_pluginSource = QFileInfo(tmpPluginPath); diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index 4fa802ce4c5..0352a3bb430 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -33,12 +33,12 @@ #include #include +#include #include #include #include #include -#include #include #include @@ -155,11 +155,13 @@ void Settings::save(const QString &path) const { QFile tmpFile(QString::fromLatin1("%1/mumble_settings.json.tmp") .arg(QStandardPaths::writableLocation(QStandardPaths::TempLocation))); - { - // The separate scope makes sure, the stream is closed again after the write has finished - std::ofstream stream(tmpFile.fileName().toUtf8()); + boost::filesystem::path nativePath(tmpFile.fileName().toUtf8().data()); + boost::filesystem::ofstream stream(nativePath); + stream << settingsJSON.dump(4) << std::endl; + stream.close(); - stream << settingsJSON.dump(4) << std::endl; + if (stream.fail()) { + qWarning("Failed at writing temporary settings file: %s", qUtf8Printable(tmpFile.fileName())); } QFile targetFile(path); @@ -222,7 +224,8 @@ void Settings::load(const QString &path) { settingsLocation = path; } - std::ifstream stream(path.toUtf8()); + boost::filesystem::path nativePath(path.toUtf8().data()); + boost::filesystem::ifstream stream(nativePath); nlohmann::json settingsJSON; try { @@ -611,13 +614,15 @@ void OverlaySettings::savePresets(const QString &filename) { settingsJSON.erase(SettingsKeys::OVERLAY_LAUNCHERS_KEY); settingsJSON.erase(SettingsKeys::OVERLAY_LAUNCHERS_EXCLUDE_KEY); - std::ofstream stream(filename.toUtf8()); + boost::filesystem::path nativePath(filename.toUtf8().data()); + boost::filesystem::ofstream stream(nativePath); stream << settingsJSON.dump(4) << std::endl; } void OverlaySettings::load(const QString &filename) { - std::ifstream stream(filename.toUtf8()); + boost::filesystem::path nativePath(filename.toUtf8().data()); + boost::filesystem::ifstream stream(nativePath); nlohmann::json settingsJSON; try {