FileSearch: Add a static_assert for the preferred separator
This commit is contained in:
parent
382356627a
commit
1fc5eae5bd
|
@ -113,9 +113,11 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
|
||||||
std::sort(result.begin(), result.end());
|
std::sort(result.begin(), result.end());
|
||||||
result.erase(std::unique(result.begin(), result.end()), result.end());
|
result.erase(std::unique(result.begin(), result.end()), result.end());
|
||||||
|
|
||||||
// Dolphin expects to be able to use "/" (DIR_SEP) everywhere. std::filesystem uses the OS
|
// Dolphin expects to be able to use "/" (DIR_SEP) everywhere.
|
||||||
// separator.
|
// std::filesystem uses the OS separator.
|
||||||
if (fs::path::preferred_separator != DIR_SEP_CHR)
|
constexpr fs::path::value_type os_separator = fs::path::preferred_separator;
|
||||||
|
static_assert(os_separator == DIR_SEP_CHR || os_separator == '\\', "Unsupported path separator");
|
||||||
|
if (os_separator != DIR_SEP_CHR)
|
||||||
for (auto& path : result)
|
for (auto& path : result)
|
||||||
std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR);
|
std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue