[Scummvm-git-logs] scummvm master -> bde10f0dda17b5f3795381aa34e0f5b7939d0893
criezy
noreply at scummvm.org
Sun Jun 5 14:39:42 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
bde10f0dda BASE: Store screenshotpath command line in Session domain
Commit: bde10f0dda17b5f3795381aa34e0f5b7939d0893
https://github.com/scummvm/scummvm/commit/bde10f0dda17b5f3795381aa34e0f5b7939d0893
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-06-05T15:39:36+01:00
Commit Message:
BASE: Store screenshotpath command line in Session domain
The SDL backend was getting that path at the start and storing
it in a class member so that it would persist for the session.
But now that we have a kSessionDomain in ConfMan, it is cleaner
to use that (and this will also work for non-SDL backends).
Changed paths:
backends/platform/sdl/sdl.cpp
backends/platform/sdl/sdl.h
backends/platform/sdl/win32/win32.cpp
base/commandLine.cpp
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 784580cc9e1..a751360422b 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -204,13 +204,6 @@ void OSystem_SDL::initBackend() {
_logger->open(logFile);
}
- // In case the user specified the screenshot path, we get it here.
- // That way if it was specified on the command line we will not lose it
- // when the launcher is started (as it clears the ConfMan transient domain).
- _userScreenshotPath = ConfMan.get("screenshotpath");
- if (!_userScreenshotPath.empty() && !_userScreenshotPath.hasSuffix("/"))
- _userScreenshotPath += "/";
-
#if SDL_VERSION_ATLEAST(2, 0, 0)
const char *sdlDriverName = SDL_GetCurrentVideoDriver();
// Allow the screen to turn off
@@ -763,7 +756,10 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
//Not specified in base class
Common::String OSystem_SDL::getScreenshotsPath() {
- return _userScreenshotPath;
+ Common::String path = ConfMan.get("screenshotpath");
+ if (!path.empty() && !path.hasSuffix("/"))
+ path += "/";
+ return path;
}
#ifdef USE_OPENGL
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 3569db2c966..f7dd0b8a2e0 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -119,12 +119,6 @@ protected:
*/
Common::String _logFilePath;
- /**
- * A path specified by the user where screenshots are created.
- * This may be empty, in which case a OS-dependent default path is used.
- */
- Common::String _userScreenshotPath;
-
/**
* The event source we use for obtaining SDL events.
*/
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 3df2d243c01..19bbcaaf3e5 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -255,14 +255,10 @@ Common::String OSystem_Win32::getSystemLanguage() const {
Common::String OSystem_Win32::getScreenshotsPath() {
// If the user has configured a screenshots path, use it
- Common::String screenshotsPath = OSystem_SDL::getScreenshotsPath();
+ Common::String screenshotsPath = ConfMan.get("screenshotpath");
if (!screenshotsPath.empty()) {
- // OSystem_SDL may have appended a '/' at the end
- if (screenshotsPath.hasSuffix("/")) {
- screenshotsPath.deleteLastChar();
- if (!screenshotsPath.hasSuffix("\\") && !screenshotsPath.hasSuffix("/"))
- screenshotsPath += "\\";
- }
+ if (!screenshotsPath.hasSuffix("\\") && !screenshotsPath.hasSuffix("/"))
+ screenshotsPath += "\\";
return screenshotsPath;
}
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 53ff2398291..8bff9e3642d 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1856,7 +1856,8 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
storeSessionSetting("enable-gs", "enable_gs", settings);
storeSessionSetting("opl-driver", "opl_driver", settings);
storeSessionSetting("talkspeed", "talkspeed", settings);
- storeSessionSetting("render-mode", "render_mode", settings);
+ storeSessionSetting("render-mode", "render_mode", settings);
+ storeSessionSetting("screenshotpath", "screenshotpath", settings);
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
More information about the Scummvm-git-logs
mailing list