Don't ignore '\' characters when '/' isn't present in file names

This commit is contained in:
Username404-59 2021-10-14 22:52:44 +02:00
parent 6bb6fa4dda
commit cf6e5cfaf8
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 7 additions and 7 deletions

View File

@ -50,16 +50,16 @@ int main(int argc, char* argv[]) {
} catch (const Yerbacon::Exception& error) {
unsigned long lastSlash = 0;
unsigned long position1 = fileName.find_last_of('/');
if (cmp_not_equal(position1, string_view::npos)) {
if constexpr(filesystem::path::preferred_separator == '/') {
if (cmp_not_equal(position1, string_view::npos)) {
lastSlash = position1;
}
} else {
unsigned long position2 = fileName.find_last_of(filesystem::path::preferred_separator);
if (cmp_not_equal(position2, string_view::npos)) {
lastSlash = max(position1, position2);
}
}
}
resultingPair.first = fileName.substr(lastSlash + 1);
resultingPair.second.emplace(error);
}