Skip to content

Commit 19fae64

Browse files
committed
Replace boost with native C++17 functionality
This commit replaces boost's filesystem library with its native C++17 counterparts. Makes deployment a little easier (no need to worry about a static build of boost). Hopefully fixes some boost-related filesystem issues, too.
1 parent a10331f commit 19fae64

25 files changed

+205
-173
lines changed

Diff for: src/deployers/BasicPluginsDeployer.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// system headers
2+
#include <filesystem>
23
#include <utility>
34

45
// library headers
@@ -10,15 +11,16 @@
1011
using namespace linuxdeploy::core::log;
1112
using namespace linuxdeploy::core::appdir;
1213
using namespace linuxdeploy::plugin::qt;
13-
namespace bf = boost::filesystem;
14+
15+
namespace fs = std::filesystem;
1416

1517
BasicPluginsDeployer::BasicPluginsDeployer(std::string moduleName,
1618
core::appdir::AppDir& appDir,
17-
bf::path qtPluginsPath,
18-
bf::path qtLibexecsPath,
19-
bf::path installLibsPath,
20-
bf::path qtTranslationsPath,
21-
bf::path qtDataPath) : moduleName(std::move(moduleName)),
19+
fs::path qtPluginsPath,
20+
fs::path qtLibexecsPath,
21+
fs::path installLibsPath,
22+
fs::path qtTranslationsPath,
23+
fs::path qtDataPath) : moduleName(std::move(moduleName)),
2224
appDir(appDir),
2325
qtPluginsPath(std::move(qtPluginsPath)),
2426
qtLibexecsPath(std::move(qtLibexecsPath)),

Diff for: src/deployers/BasicPluginsDeployer.h

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
// system headers
4+
#include <filesystem>
45
#include <memory>
56

67
// library headers
@@ -22,11 +23,11 @@ namespace linuxdeploy {
2223
core::appdir::AppDir& appDir;
2324

2425
// Qt data
25-
const boost::filesystem::path qtPluginsPath;
26-
const boost::filesystem::path qtLibexecsPath;
27-
const boost::filesystem::path qtInstallQmlPath;
28-
const boost::filesystem::path qtTranslationsPath;
29-
const boost::filesystem::path qtDataPath;
26+
const std::filesystem::path qtPluginsPath;
27+
const std::filesystem::path qtLibexecsPath;
28+
const std::filesystem::path qtInstallQmlPath;
29+
const std::filesystem::path qtTranslationsPath;
30+
const std::filesystem::path qtDataPath;
3031

3132
public:
3233
/**
@@ -35,11 +36,11 @@ namespace linuxdeploy {
3536
* @param moduleName
3637
*/
3738
explicit BasicPluginsDeployer(std::string moduleName, core::appdir::AppDir& appDir,
38-
boost::filesystem::path qtPluginsPath,
39-
boost::filesystem::path qtLibexecsPath,
40-
boost::filesystem::path installLibsPath,
41-
boost::filesystem::path qtTranslationsPath,
42-
boost::filesystem::path qtDataPath);
39+
std::filesystem::path qtPluginsPath,
40+
std::filesystem::path qtLibexecsPath,
41+
std::filesystem::path installLibsPath,
42+
std::filesystem::path qtTranslationsPath,
43+
std::filesystem::path qtDataPath);
4344

4445
/**
4546
* Default destroyer is good enough for this class for now, but in case we need to change this we declare a virtual

Diff for: src/deployers/BearerPluginsDeployer.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
// system headers
2+
#include <filesystem>
3+
14
// library headers
25
#include <linuxdeploy/core/log.h>
3-
#include <boost/filesystem.hpp>
46

57
// local headers
68
#include "BearerPluginsDeployer.h"
79

810
using namespace linuxdeploy::plugin::qt;
911
using namespace linuxdeploy::core::log;
1012

11-
namespace bf = boost::filesystem;
13+
namespace fs = std::filesystem;
1214

1315
bool BearerPluginsDeployer::deploy() {
1416
// calling the default code is optional, but it won't hurt for now
@@ -17,7 +19,7 @@ bool BearerPluginsDeployer::deploy() {
1719

1820
ldLog() << "Deploying bearer plugins" << std::endl;
1921

20-
for (bf::directory_iterator i(qtPluginsPath / "bearer"); i != bf::directory_iterator(); ++i) {
22+
for (fs::directory_iterator i(qtPluginsPath / "bearer"); i != fs::directory_iterator(); ++i) {
2123
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/bearer/"))
2224
return false;
2325
}

Diff for: src/deployers/GamepadPluginsDeployer.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
// system headers
2+
#include <filesystem>
3+
14
// library headers
25
#include <linuxdeploy/core/log.h>
3-
#include <boost/filesystem.hpp>
46

57
// local headers
68
#include "GamepadPluginsDeployer.h"
79

810
using namespace linuxdeploy::plugin::qt;
911
using namespace linuxdeploy::core::log;
1012

11-
namespace bf = boost::filesystem;
13+
namespace fs = std::filesystem;
1214

1315
bool GamepadPluginsDeployer::deploy() {
1416
// calling the default code is optional, but it won't hurt for now
@@ -17,7 +19,7 @@ bool GamepadPluginsDeployer::deploy() {
1719

1820
ldLog() << "Deploying Gamepad plugins" << std::endl;
1921

20-
for (bf::directory_iterator i(qtPluginsPath / "gamepads"); i != bf::directory_iterator(); ++i) {
22+
for (fs::directory_iterator i(qtPluginsPath / "gamepads"); i != fs::directory_iterator(); ++i) {
2123
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/gamepads/"))
2224
return false;
2325
}

Diff for: src/deployers/MultimediaPluginsDeployer.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
// system headers
2+
#include <filesystem>
3+
14
// library headers
25
#include <linuxdeploy/core/log.h>
3-
#include <boost/filesystem.hpp>
46

57
// local headers
68
#include "MultimediaPluginsDeployer.h"
79

810
using namespace linuxdeploy::plugin::qt;
911
using namespace linuxdeploy::core::log;
1012

11-
namespace bf = boost::filesystem;
13+
namespace fs = std::filesystem;
1214

1315
bool MultimediaPluginsDeployer::deploy() {
1416
// calling the default code is optional, but it won't hurt for now
@@ -17,14 +19,14 @@ bool MultimediaPluginsDeployer::deploy() {
1719

1820
ldLog() << "Deploying mediaservice plugins" << std::endl;
1921

20-
for (bf::directory_iterator i(qtPluginsPath / "mediaservice"); i != bf::directory_iterator(); ++i) {
22+
for (fs::directory_iterator i(qtPluginsPath / "mediaservice"); i != fs::directory_iterator(); ++i) {
2123
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/mediaservice/"))
2224
return false;
2325
}
2426

2527
ldLog() << "Deploying audio plugins" << std::endl;
2628

27-
for (bf::directory_iterator i(qtPluginsPath / "audio"); i != bf::directory_iterator(); ++i) {
29+
for (fs::directory_iterator i(qtPluginsPath / "audio"); i != fs::directory_iterator(); ++i) {
2830
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/audio/"))
2931
return false;
3032
}

Diff for: src/deployers/PlatformPluginsDeployer.cpp

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
// system headers
2+
#include <filesystem>
3+
14
// library headers
25
#include <linuxdeploy/core/log.h>
36
#include <linuxdeploy/util/util.h>
4-
#include <boost/filesystem.hpp>
57

68
// local headers
79
#include "PlatformPluginsDeployer.h"
810

911
using namespace linuxdeploy::plugin::qt;
1012
using namespace linuxdeploy::core::log;
1113

12-
namespace bf = boost::filesystem;
14+
namespace fs = std::filesystem;
1315

1416
bool PlatformPluginsDeployer::deploy() {
1517
// calling the default code is optional, but it won't hurt for now
@@ -32,34 +34,34 @@ bool PlatformPluginsDeployer::deploy() {
3234
}
3335
}
3436

35-
for (bf::directory_iterator i(qtPluginsPath / "platforminputcontexts"); i != bf::directory_iterator(); ++i) {
37+
for (fs::directory_iterator i(qtPluginsPath / "platforminputcontexts"); i != fs::directory_iterator(); ++i) {
3638
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/platforminputcontexts/"))
3739
return false;
3840
}
3941

40-
for (bf::directory_iterator i(qtPluginsPath / "imageformats"); i != bf::directory_iterator(); ++i) {
42+
for (fs::directory_iterator i(qtPluginsPath / "imageformats"); i != fs::directory_iterator(); ++i) {
4143
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/imageformats/"))
4244
return false;
4345
}
4446

4547
// TODO: platform themes -- https://github.com/probonopd/linuxdeployqt/issues/236
4648

47-
const bf::path platformThemesPath = qtPluginsPath / "platformthemes";
48-
const bf::path stylesPath = qtPluginsPath / "styles";
49+
const fs::path platformThemesPath = qtPluginsPath / "platformthemes";
50+
const fs::path stylesPath = qtPluginsPath / "styles";
4951

50-
const bf::path platformThemesDestination = appDir.path() / "usr/plugins/platformthemes/";
51-
const bf::path stylesDestination = appDir.path() / "usr/plugins/styles/";
52+
const fs::path platformThemesDestination = appDir.path() / "usr/plugins/platformthemes/";
53+
const fs::path stylesDestination = appDir.path() / "usr/plugins/styles/";
5254

5355
if (getenv("DEPLOY_PLATFORM_THEMES") != nullptr) {
5456
ldLog() << LD_WARNING << "Deploying all platform themes and styles [experimental feature]" << std::endl;
5557

56-
if (bf::is_directory(platformThemesPath))
57-
for (bf::directory_iterator i(platformThemesPath); i != bf::directory_iterator(); ++i)
58+
if (fs::is_directory(platformThemesPath))
59+
for (fs::directory_iterator i(platformThemesPath); i != fs::directory_iterator(); ++i)
5860
if (!appDir.deployLibrary(*i, platformThemesDestination))
5961
return false;
6062

61-
if (bf::is_directory(stylesPath))
62-
for (bf::directory_iterator i(stylesPath); i != bf::directory_iterator(); ++i)
63+
if (fs::is_directory(stylesPath))
64+
for (fs::directory_iterator i(stylesPath); i != fs::directory_iterator(); ++i)
6365
if (!appDir.deployLibrary(*i, stylesDestination))
6466
return false;
6567
} else {
@@ -69,7 +71,7 @@ bool PlatformPluginsDeployer::deploy() {
6971

7072
for (const auto &file : {libqxdgPath}) {
7173
// we need to check whether the files exist at least, otherwise the deferred deployment operation fails
72-
if (bf::is_regular_file(file)) {
74+
if (fs::is_regular_file(file)) {
7375
ldLog() << "Attempting to deploy" << file.filename() << "found at path" << file.parent_path() << std::endl;
7476
appDir.deployFile(file, platformThemesDestination);
7577
} else {

Diff for: src/deployers/PluginsDeployerFactory.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
using namespace linuxdeploy::plugin::qt;
2020
using namespace linuxdeploy::core::appdir;
21-
namespace bf = boost::filesystem;
21+
namespace fs = std::filesystem;
2222

2323
PluginsDeployerFactory::PluginsDeployerFactory(AppDir& appDir,
24-
bf::path qtPluginsPath,
25-
bf::path qtLibexecsPath,
26-
bf::path qtInstallQmlPath,
27-
bf::path qtTranslationsPath,
28-
bf::path qtDataPath,
24+
fs::path qtPluginsPath,
25+
fs::path qtLibexecsPath,
26+
fs::path qtInstallQmlPath,
27+
fs::path qtTranslationsPath,
28+
fs::path qtDataPath,
2929
int qtMajorVersion,
3030
int qtMinorVersion) : appDir(appDir),
3131
qtPluginsPath(std::move(qtPluginsPath)),

Diff for: src/deployers/PluginsDeployerFactory.h

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#pragma once
22

33
// system headers
4+
#include <filesystem>
45
#include <memory>
56
#include <string>
67

78
// library headers
89
#include <linuxdeploy/core/appdir.h>
9-
#include <boost/filesystem.hpp>
1010

1111
// local headers
1212
#include "PluginsDeployer.h"
@@ -18,11 +18,11 @@ namespace linuxdeploy {
1818
class PluginsDeployerFactory {
1919
private:
2020
core::appdir::AppDir& appDir;
21-
const boost::filesystem::path qtPluginsPath;
22-
const boost::filesystem::path qtLibexecsPath;
23-
const boost::filesystem::path qtInstallQmlPath;
24-
const boost::filesystem::path qtTranslationsPath;
25-
const boost::filesystem::path qtDataPath;
21+
const std::filesystem::path qtPluginsPath;
22+
const std::filesystem::path qtLibexecsPath;
23+
const std::filesystem::path qtInstallQmlPath;
24+
const std::filesystem::path qtTranslationsPath;
25+
const std::filesystem::path qtDataPath;
2626
const int qtMajorVersion;
2727
const int qtMinorVersion;
2828

@@ -43,11 +43,11 @@ namespace linuxdeploy {
4343

4444
public:
4545
explicit PluginsDeployerFactory(core::appdir::AppDir& appDir,
46-
boost::filesystem::path qtPluginsPath,
47-
boost::filesystem::path qtLibexecsPath,
48-
boost::filesystem::path qtInstallQmlPath,
49-
boost::filesystem::path qtTranslationsPath,
50-
boost::filesystem::path qtDataPath,
46+
std::filesystem::path qtPluginsPath,
47+
std::filesystem::path qtLibexecsPath,
48+
std::filesystem::path qtInstallQmlPath,
49+
std::filesystem::path qtTranslationsPath,
50+
std::filesystem::path qtDataPath,
5151
int qtMajorVersion,
5252
int qtMinorVersion);
5353

Diff for: src/deployers/PositioningPluginsDeployer.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
// system headers
2+
#include <filesystem>
3+
14
// library headers
25
#include <linuxdeploy/core/log.h>
3-
#include <boost/filesystem.hpp>
46

57
// local headers
68
#include "PositioningPluginsDeployer.h"
79

810
using namespace linuxdeploy::plugin::qt;
911
using namespace linuxdeploy::core::log;
1012

11-
namespace bf = boost::filesystem;
13+
namespace fs = std::filesystem;
1214

1315
bool PositioningPluginsDeployer::deploy() {
1416
// calling the default code is optional, but it won't hurt for now
@@ -17,7 +19,7 @@ bool PositioningPluginsDeployer::deploy() {
1719

1820
ldLog() << "Deploying positioning plugins" << std::endl;
1921

20-
for (bf::directory_iterator i(qtPluginsPath / "position"); i != bf::directory_iterator(); ++i) {
22+
for (fs::directory_iterator i(qtPluginsPath / "position"); i != fs::directory_iterator(); ++i) {
2123
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/position/"))
2224
return false;
2325
}

Diff for: src/deployers/PrintSupportPluginsDeployer.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
// system headers
2+
#include <filesystem>
3+
14
// library headers
25
#include <linuxdeploy/core/log.h>
3-
#include <boost/filesystem.hpp>
46

57
// local headers
68
#include "PrintSupportPluginsDeployer.h"
79

810
using namespace linuxdeploy::plugin::qt;
911
using namespace linuxdeploy::core::log;
1012

11-
namespace bf = boost::filesystem;
13+
namespace fs = std::filesystem;
1214

1315
bool PrintSupportPluginsDeployer::deploy() {
1416
// calling the default code is optional, but it won't hurt for now
@@ -17,7 +19,7 @@ bool PrintSupportPluginsDeployer::deploy() {
1719

1820
ldLog() << "Deploying printsupport plugins" << std::endl;
1921

20-
for (bf::directory_iterator i(qtPluginsPath / "printsupport"); i != bf::directory_iterator(); ++i) {
22+
for (fs::directory_iterator i(qtPluginsPath / "printsupport"); i != fs::directory_iterator(); ++i) {
2123
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/printsupport/"))
2224
return false;
2325
}

Diff for: src/deployers/QmlPluginsDeployer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
using namespace linuxdeploy::plugin::qt;
88

9-
namespace bf = boost::filesystem;
9+
namespace fs = std::filesystem;
1010

1111
bool QmlPluginsDeployer::deploy() {
1212
// calling the default code is optional, but it won't hurt for now

0 commit comments

Comments
 (0)