aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl/win32/win32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/sdl/win32/win32.cpp')
-rw-r--r--backends/platform/sdl/win32/win32.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 99c71a49e0..02ad225749 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -29,6 +29,7 @@
#include <windows.h>
#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
#include <shellapi.h>
+#include <ShlObj.h>
#include "common/scummsys.h"
#include "common/config-manager.h"
@@ -145,6 +146,25 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
return true;
}
+Common::String OSystem_Win32::getScreenshotsPath() {
+ char picturesPath[MAXPATHLEN];
+
+ // Use the My Pictures folder.
+ if (SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK)
+ error("Unable to access My Pictures directory");
+
+ Common::String screenshotsPath = Common::String(picturesPath) + "\\ScummVM Screenshots\\";
+
+ // If the directory already exists (as it should in most cases),
+ // we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)
+ if (!CreateDirectory(screenshotsPath.c_str(), NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create ScummVM Screenshots folder");
+ }
+
+ return screenshotsPath;
+}
+
Common::String OSystem_Win32::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];