Skip to content

Commit 5576360

Browse files
committed
use namespace for filesystem
1 parent 795eecf commit 5576360

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

tools/DEV7Launcher/DEV7Launcher.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#define DEV7_MUTEX_LAUNCH "/tmp/DEV7_INSTANCE_MUTEX"
1919
#endif
2020

21+
namespace fs = std::filesystem;
22+
2123
bool fileExists(const std::string& filename) {
2224
#ifdef _WIN32
2325
return _access(filename.c_str(), 0) == 0;
@@ -119,7 +121,7 @@ void showTraceTXT() {
119121
void modifyAdibou3Ini() {
120122

121123
// Check if Adibou3.ini exists
122-
if (!std::filesystem::exists("Adibou3.ini")) {
124+
if (!fs::exists("Adibou3.ini")) {
123125
std::cout << "Error: This directory does not seem to be an Adibou 3 game directory.\n" << std::endl;
124126
std::cout << "Press Enter to exit DEV7Launcher" << std::endl;
125127
getchar();
@@ -131,12 +133,12 @@ void modifyAdibou3Ini() {
131133
// WORKAROUND: rename ADIBOU3.INI to Adibou3.ini so it will be read by the Editors as Adibou3.ini to avoid problems being loaded.
132134

133135
#ifdef _WIN32
134-
if (!std::filesystem::exists("Adibou3.ini")) {
136+
if (!fs::exists("Adibou3.ini")) {
135137
system("ren ADIBOU3.INI Adibou3.ini");
136138
}
137139
system("notepad Adibou3.ini");
138140
#else
139-
if (!std::filesystem::exists("Adibou3.ini")) {
141+
if (!fs::exists("Adibou3.ini")) {
140142
int move_adibou3 = system("mv ADIBOU3.INI Adibou3.ini");
141143
}
142144
int nano_adibou3 = system("nano Adibou3.ini");
@@ -146,7 +148,7 @@ void modifyAdibou3Ini() {
146148
void modifyAdi5Ini() {
147149

148150
// Check if Data/ADI5.ini exists
149-
if (!std::filesystem::exists("Data/ADI5.ini")) {
151+
if (!fs::exists("Data/ADI5.ini")) {
150152
std::cout << "Error: This directory does not seem to be an Adi 5 game directory.\n" << std::endl;
151153
std::cout << "Press Enter to exit DEV7Launcher" << std::endl;
152154
getchar();
@@ -166,9 +168,9 @@ void openLicenceFile() {
166168
std::string licenseFile = "Lizenzvereinbarung.txt";
167169
std::string warrantyFile = "garantie.txt";
168170
std::string lisezMoiFile = "LISEZ MOI.txt";
169-
bool foundLicense = std::filesystem::exists(licenseFile);
170-
bool foundWarranty = std::filesystem::exists(warrantyFile);
171-
bool foundLisezMoi = std::filesystem::exists(lisezMoiFile);
171+
bool foundLicense = fs::exists(licenseFile);
172+
bool foundWarranty = fs::exists(warrantyFile);
173+
bool foundLisezMoi = fs::exists(lisezMoiFile);
172174

173175
if (foundLicense || foundWarranty || foundLisezMoi) {
174176
std::string filename;
@@ -214,7 +216,7 @@ void Ed4Intro() {
214216
std::string Ed4IntroEXE = "Ed4Intro.exe";
215217

216218
// Check if Ed4Intro.exe exists
217-
if (!std::filesystem::exists("Ed4Intro.exe")) {
219+
if (!fs::exists("Ed4Intro.exe")) {
218220
std::cout << "Error: This directory does not seem to be an Le Pays des pierres magiques game directory.\n" << std::endl;
219221
return;
220222
}
@@ -427,4 +429,4 @@ if (restartChoice == 'n' || restartChoice == 'N') {
427429

428430
return 0;
429431

430-
}
432+
} // End of namespace fs

tools/ModelPathDumper/ModelPathDumper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ int main() {
6565

6666
std::cout << "Search is completed. Found " << exoCount << " .exo files.\n" << std::endl;
6767
return 0;
68-
}
68+
69+
} // End of namespace fs

tools/OBCViewer/OBCViewer.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <ctime>
66
#include <unistd.h>
77

8+
namespace fs = std::filesystem;
9+
810
const std::string versionNumber = "1.6";
911

1012
void printHeader() {
@@ -42,7 +44,7 @@ int main(int argc, char* argv[]) {
4244
std::string username = getlogin();
4345

4446
// Check if the input file is an OBC Script.
45-
std::filesystem::path inputScript(inputOBC);
47+
fs::path inputScript(inputOBC);
4648
if (inputScript.extension() != ".obc") {
4749
std::cerr << "Error: This File is not an OBC Script!" << std::endl;
4850
return 1;
@@ -118,7 +120,7 @@ int main(int argc, char* argv[]) {
118120

119121
// Display the full path of the output file of the OBC Script
120122
std::cout << std::endl;
121-
printf("Output file created at: %s\n", std::filesystem::absolute(inputScript.stem().string() + ".txt").c_str());
123+
printf("Output file created at: %s\n", fs::absolute(inputScript.stem().string() + ".txt").c_str());
122124

123125
// Exit message for OBCViewer
124126
std::cout << std::endl;
@@ -127,4 +129,5 @@ int main(int argc, char* argv[]) {
127129
clearConsole();
128130

129131
return 0;
130-
}
132+
133+
} // End of namespace fs

tools/OBJDumper/OBJDumper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ int main() {
9999
dumpUniqueObjFiles(inputFile, outputLocation, useSlash);
100100

101101
return 0;
102-
}
102+
103+
} // End of namespace fs

0 commit comments

Comments
 (0)