From b593fe2f451a7242cc4926fe7bdc927e3676a9aa Mon Sep 17 00:00:00 2001 From: sluicebox Date: Sat, 9 Nov 2019 15:14:47 -0800 Subject: SDL: Fix Windows screenshots with unicode paths Use Common::FSNode to test for screenshot existence instead of SDL_RWFromFile(). SDL does different character encoding conversions which fail on Windows when a unicode character is in the path. Fixes bug #11118 --- backends/graphics/sdl/sdl-graphics.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'backends/graphics/sdl') diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp index 0d310a4174..e5a49cefb5 100644 --- a/backends/graphics/sdl/sdl-graphics.cpp +++ b/backends/graphics/sdl/sdl-graphics.cpp @@ -25,6 +25,7 @@ #include "backends/platform/sdl/sdl.h" #include "backends/events/sdl/sdl-events.h" #include "common/config-manager.h" +#include "common/fs.h" #include "common/textconsole.h" #include "graphics/scaler/aspect.h" #ifdef USE_OSD @@ -279,19 +280,16 @@ void SdlGraphicsManager::saveScreenshot() { screenshotsPath = sdl_g_system->getScreenshotsPath(); for (int n = 0;; n++) { - SDL_RWops *file; - #ifdef USE_PNG filename = Common::String::format("scummvm%05d.png", n); #else filename = Common::String::format("scummvm%05d.bmp", n); #endif - file = SDL_RWFromFile((screenshotsPath + filename).c_str(), "r"); - - if (!file) + Common::FSNode file = Common::FSNode(screenshotsPath + filename); + if (!file.exists()) { break; - SDL_RWclose(file); + } } if (saveScreenshot(screenshotsPath + filename)) { -- cgit v1.2.3