Use filesystem::path::preferred_separator at compile time to remove a few preprocessor directives in main.cpp
This commit is contained in:
parent
429ed02483
commit
a2b67298a4
|
@ -2,6 +2,7 @@
|
|||
#include <set>
|
||||
#include "headers/Yerbacon.hpp"
|
||||
#include <future>
|
||||
#include <filesystem>
|
||||
using namespace std;
|
||||
|
||||
#include "headers/misc.hpp"
|
||||
|
@ -49,14 +50,14 @@ int main(int argc, char* argv[]) {
|
|||
unsigned long lastSlash = 0;
|
||||
unsigned long position1 = fileName.find_last_of('/');
|
||||
if (cmp_not_equal(position1, string_view::npos)) {
|
||||
#ifndef _WIN32
|
||||
if constexpr(filesystem::path::preferred_separator == '/') {
|
||||
lastSlash = position1;
|
||||
#else
|
||||
unsigned long position2 = fileName.find_last_of('\\');
|
||||
} else {
|
||||
unsigned long position2 = fileName.find_last_of(filesystem::path::preferred_separator);
|
||||
if (cmp_not_equal(position2, string_view::npos)) {
|
||||
lastSlash = max(position1, position2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
resultingPair.first = fileName.substr(lastSlash + 1);
|
||||
resultingPair.second.emplace(error);
|
||||
|
|
Loading…
Reference in New Issue