From 38774867121728f19cc6dd48104e394bed911a30 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 28 Jun 2024 15:37:03 +1000 Subject: [PATCH] System: Ensure titles are sanitized for screenshots --- src/core/system.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index 900bd5a27..e7039f373 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -4764,13 +4764,13 @@ bool System::SaveScreenshot(const char* filename, DisplayScreenshotMode mode, Di std::string auto_filename; if (!filename) { - const std::string& name = System::GetGameTitle(); + const std::string sanitized_name = Path::SanitizeFileName(System::GetGameTitle()); const char* extension = Settings::GetDisplayScreenshotFormatExtension(format); std::string basename; - if (name.empty()) + if (sanitized_name.empty()) basename = fmt::format("{}", GetTimestampStringForFileName()); else - basename = fmt::format("{} {}", name, GetTimestampStringForFileName()); + basename = fmt::format("{} {}", sanitized_name, GetTimestampStringForFileName()); auto_filename = fmt::format("{}" FS_OSPATH_SEPARATOR_STR "{}.{}", EmuFolders::Screenshots, basename, extension);