aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics
diff options
context:
space:
mode:
authorsluicebox2019-11-09 15:14:47 -0800
committerFilippos Karapetis2019-11-10 07:08:22 +0200
commitb593fe2f451a7242cc4926fe7bdc927e3676a9aa (patch)
tree9c75efda5c4ad9057639c944a649b2340c131081 /backends/graphics
parent4952d1c760eec45add83cee0540f10b4799e91d7 (diff)
downloadscummvm-rg350-b593fe2f451a7242cc4926fe7bdc927e3676a9aa.tar.gz
scummvm-rg350-b593fe2f451a7242cc4926fe7bdc927e3676a9aa.tar.bz2
scummvm-rg350-b593fe2f451a7242cc4926fe7bdc927e3676a9aa.zip
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
Diffstat (limited to 'backends/graphics')
-rw-r--r--backends/graphics/sdl/sdl-graphics.cpp10
1 files changed, 4 insertions, 6 deletions
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)) {