Skip to content

Commit 61e3e44

Browse files
committed
CHANGE(client): Migrate boost::filesystem to std
Since we are now using C++17, we can make use of the std::filesystem::path API for use with our std::fstreams. This commit replaces boost::filesystem::path introduced by 91f1177 with std::filesystem::path
1 parent 91f1177 commit 61e3e44

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

src/QtUtils.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <QStringList>
88
#include <QUrl>
99

10-
#include <boost/filesystem.hpp>
10+
#include <filesystem>
1111

1212
namespace Mumble {
1313
namespace QtUtils {
@@ -25,11 +25,11 @@ namespace QtUtils {
2525
return QString();
2626
}
2727

28-
boost::filesystem::path qstring_to_path(const QString &input) {
28+
std::filesystem::path qstring_to_path(const QString &input) {
2929
#ifdef _WIN32
30-
return boost::filesystem::path(input.toStdWString());
30+
return std::filesystem::path(input.toStdWString());
3131
#else
32-
return boost::filesystem::path(input.toUtf8());
32+
return std::filesystem::path(input.toUtf8());
3333
#endif
3434
}
3535

src/QtUtils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <QString>
1111
#include <QStringList>
1212

13-
#include <boost/filesystem.hpp>
13+
#include <filesystem>
1414

1515
#include <memory>
1616

@@ -39,7 +39,7 @@ namespace QtUtils {
3939
/**
4040
* Creates a platform agnostic path from a QString
4141
*/
42-
boost::filesystem::path qstring_to_path(const QString &input);
42+
std::filesystem::path qstring_to_path(const QString &input);
4343

4444
} // namespace QtUtils
4545
} // namespace Mumble

src/mumble/PluginInstaller.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
#include <QtGui/QIcon>
2020

2121
#include <exception>
22+
#include <fstream>
2223
#include <string>
2324

24-
#include <boost/filesystem/fstream.hpp>
25-
2625
#include <Poco/Exception.h>
2726
#include <Poco/FileStream.h>
2827
#include <Poco/StreamCopier.h>
@@ -129,8 +128,7 @@ void PluginInstaller::init() {
129128

130129
zipInput.clear();
131130
Poco::Zip::ZipInputStream zipin(zipInput, pluginIt->second);
132-
boost::filesystem::ofstream out(Mumble::QtUtils::qstring_to_path(tmpPluginPath),
133-
std::ios::out | std::ios::binary);
131+
std::ofstream out(Mumble::QtUtils::qstring_to_path(tmpPluginPath), std::ios::out | std::ios::binary);
134132
Poco::StreamCopier::copyStream(zipin, out);
135133

136134
m_pluginSource = QFileInfo(tmpPluginPath);

src/mumble/Settings.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
#include <QStandardPaths>
3535
#include <QSystemTrayIcon>
3636

37-
#include <boost/filesystem/fstream.hpp>
3837
#include <boost/typeof/typeof.hpp>
3938

4039
#include <algorithm>
4140
#include <cassert>
4241
#include <cstring>
42+
#include <fstream>
4343
#include <limits>
4444
#include <memory>
4545

@@ -156,7 +156,7 @@ void Settings::save(const QString &path) const {
156156
QFile tmpFile(QString::fromLatin1("%1/mumble_settings.json.tmp")
157157
.arg(QStandardPaths::writableLocation(QStandardPaths::TempLocation)));
158158

159-
boost::filesystem::ofstream stream(Mumble::QtUtils::qstring_to_path(tmpFile.fileName()));
159+
std::ofstream stream(Mumble::QtUtils::qstring_to_path(tmpFile.fileName()));
160160
stream << settingsJSON.dump(4) << std::endl;
161161
stream.close();
162162

@@ -224,7 +224,7 @@ void Settings::load(const QString &path) {
224224
settingsLocation = path;
225225
}
226226

227-
boost::filesystem::ifstream stream(Mumble::QtUtils::qstring_to_path(path));
227+
std::ifstream stream(Mumble::QtUtils::qstring_to_path(path));
228228

229229
nlohmann::json settingsJSON;
230230
try {
@@ -613,13 +613,13 @@ void OverlaySettings::savePresets(const QString &filename) {
613613
settingsJSON.erase(SettingsKeys::OVERLAY_LAUNCHERS_KEY);
614614
settingsJSON.erase(SettingsKeys::OVERLAY_LAUNCHERS_EXCLUDE_KEY);
615615

616-
boost::filesystem::ofstream stream(Mumble::QtUtils::qstring_to_path(filename));
616+
std::ofstream stream(Mumble::QtUtils::qstring_to_path(filename));
617617

618618
stream << settingsJSON.dump(4) << std::endl;
619619
}
620620

621621
void OverlaySettings::load(const QString &filename) {
622-
boost::filesystem::ifstream stream(Mumble::QtUtils::qstring_to_path(filename));
622+
std::ifstream stream(Mumble::QtUtils::qstring_to_path(filename));
623623

624624
nlohmann::json settingsJSON;
625625
try {

0 commit comments

Comments
 (0)