Path: Unicode handling and tests for SanitizeFileName

This commit is contained in:
Connor McLaughlin
2022-07-30 21:46:14 +10:00
parent 12875cbcac
commit 89659db7ee
9 changed files with 131 additions and 51 deletions

View File

@ -1747,8 +1747,7 @@ const std::string& Achievements::GetAchievementBadgePath(const Achievement& achi
return badge_path;
// well, this comes from the internet.... :)
std::string clean_name(achievement.badge_name);
Path::SanitizeFileName(clean_name);
const std::string clean_name(Path::SanitizeFileName(achievement.badge_name));
badge_path = Path::Combine(s_achievement_icon_cache_directory,
fmt::format("{}{}.png", clean_name, achievement.locked ? "_lock" : ""));
if (FileSystem::FileExists(badge_path.c_str()))

View File

@ -660,8 +660,7 @@ std::string GameList::GetNewCoverImagePathForEntry(const Entry* entry, const cha
}
// Check for illegal characters, use serial instead.
std::string sanitized_name(entry->title);
Path::SanitizeFileName(sanitized_name);
const std::string sanitized_name(Path::SanitizeFileName(entry->title));
std::string name;
if (sanitized_name != entry->title)