summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileSearch.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-06-26 11:50:10 +0200
committerJosJuice <josjuice@gmail.com>2017-06-26 11:50:10 +0200
commit1fc5eae5bd99e9a17e634f48e8291e6eed4202cc (patch)
treea270f7fb341ef28fba7dce84c0c73a3adf48995d /Source/Core/Common/FileSearch.cpp
parent382356627ae06e8b4a84d8ff474d7b4cd279b284 (diff)
FileSearch: Add a static_assert for the preferred separator
Diffstat (limited to 'Source/Core/Common/FileSearch.cpp')
-rw-r--r--Source/Core/Common/FileSearch.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp
index 0a8d0b369c..fd031a524c 100644
--- a/Source/Core/Common/FileSearch.cpp
+++ b/Source/Core/Common/FileSearch.cpp
@@ -113,9 +113,11 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
std::sort(result.begin(), 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
- // separator.
- if (fs::path::preferred_separator != DIR_SEP_CHR)
+ // Dolphin expects to be able to use "/" (DIR_SEP) everywhere.
+ // std::filesystem uses the OS separator.
+ 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)
std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR);