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;
}

View File

@ -247,7 +247,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename)
if (!write_sector(file, s_fsinfo_sector))
goto FailWrite;
if (BACKUP_BOOT_SECTOR > 0)
if constexpr (BACKUP_BOOT_SECTOR > 0)
{
if (!write_empty(file, BACKUP_BOOT_SECTOR - 2))
goto FailWrite;