apply if constexpr in a couple places

This commit is contained in:
Shawn Hoffman 2020-08-21 18:04:50 -07:00
parent ccbc4c2d99
commit 181e0dba21
2 changed files with 4 additions and 2 deletions

View file

@ -125,9 +125,11 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
// 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)
if constexpr (os_separator != DIR_SEP_CHR)
{
for (auto& path : result)
std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR);
}
return result;
}