diff --git a/src/mumble/PluginInstaller.cpp b/src/mumble/PluginInstaller.cpp index 4740acb0f6..aa1e303ba3 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.toStdString()); + 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 4fa802ce4c..e70c4bebe9 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()); + 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()); + 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()); + 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()); + boost::filesystem::ifstream stream(nativePath); nlohmann::json settingsJSON; try {