aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorThierry Crozat2017-04-24 00:51:57 +0100
committerThierry Crozat2017-04-24 01:07:05 +0100
commite96c057c3d7d2deb8ff31bc7d798d455f74b399a (patch)
treeb5d1c30acfbc39f44ff2a0c132555beda2d891bf /backends/platform
parent11dd33bb73c998116c2b862389b616fe9249579b (diff)
downloadscummvm-rg350-e96c057c3d7d2deb8ff31bc7d798d455f74b399a.tar.gz
scummvm-rg350-e96c057c3d7d2deb8ff31bc7d798d455f74b399a.tar.bz2
scummvm-rg350-e96c057c3d7d2deb8ff31bc7d798d455f74b399a.zip
SDL: Allow specifying the screenshot directory in the config file
There is no GUI option to set the screenshot directory, but this allows power users to set it if they don't want to use the default.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp4
-rw-r--r--backends/platform/sdl/sdl.cpp5
-rw-r--r--backends/platform/sdl/win32/win32.cpp15
3 files changed, 19 insertions, 5 deletions
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 500e438ec0..8669bf6a66 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -188,7 +188,9 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
}
Common::String OSystem_MacOSX::getScreenshotsPath() {
- Common::String path = getDesktopPathMacOSX();
+ Common::String path = ConfMan.get("screenshotpath");
+ if (path.empty())
+ path = getDesktopPathMacOSX();
if (!path.empty() && !path.hasSuffix("/"))
path += "/";
return path;
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 09268f3a53..9a5db7f110 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -573,7 +573,10 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
//Not specified in base class
Common::String OSystem_SDL::getScreenshotsPath() {
- return Common::String();
+ Common::String path = ConfMan.get("screenshotpath");
+ if (!path.empty() && !path.hasSuffix("/"))
+ path += "/";
+ return path;
}
#ifdef USE_OPENGL
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 02ad225749..5724250109 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -147,13 +147,22 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
}
Common::String OSystem_Win32::getScreenshotsPath() {
+ Common::String screenshotsPath = ConfMan.get("screenshotpath");
+ if (!screenshotsPath.empty()) {
+ if (!screenshotsPath.hasSuffix("\\") && !screenshotsPath.hasSuffix("/")
+ screenshotsPath += "\\";
+ return screenshotsPath;
+ }
+
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");
+ if (SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK) {
+ warning("Unable to access My Pictures directory");
+ return Common::String();
+ }
- Common::String screenshotsPath = Common::String(picturesPath) + "\\ScummVM Screenshots\\";
+ 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)