[Scummvm-git-logs] scummvm master -> b196d26b3e38fdb2b57d622b251325ae51f47b71

criezy criezy at scummvm.org
Fri Apr 17 21:39:54 UTC 2020


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:
b196d26b3e SDL: Add --logfile command line argument to specify logfile path


Commit: b196d26b3e38fdb2b57d622b251325ae51f47b71
    https://github.com/scummvm/scummvm/commit/b196d26b3e38fdb2b57d622b251325ae51f47b71
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-17T22:39:50+01:00

Commit Message:
SDL: Add --logfile command line argument to specify logfile path

Changed paths:
    backends/platform/sdl/sdl.cpp
    base/commandLine.cpp


diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index f5d335ac07..3b11d8191c 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -150,16 +150,6 @@ void OSystem_SDL::init() {
 	// Disable OS cursor
 	SDL_ShowCursor(SDL_DISABLE);
 
-	if (!_logger)
-		_logger = new Backends::Log::Log(this);
-
-	if (_logger) {
-		Common::WriteStream *logFile = createLogFile();
-		if (logFile)
-			_logger->open(logFile);
-	}
-
-
 	// Creates the early needed managers, if they don't exist yet
 	// (we check for this to allow subclasses to provide their own).
 	if (_mutexManager == 0)
@@ -189,6 +179,15 @@ void OSystem_SDL::initBackend() {
 	// Check if backend has not been initialized
 	assert(!_inited);
 
+	if (!_logger)
+		_logger = new Backends::Log::Log(this);
+
+	if (_logger) {
+		Common::WriteStream *logFile = createLogFile();
+		if (logFile)
+			_logger->open(logFile);
+	}
+
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	const char *sdlDriverName = SDL_GetCurrentVideoDriver();
 #else
@@ -435,7 +434,11 @@ Common::WriteStream *OSystem_SDL::createLogFile() {
 	// of a failure, we know that no log file is open.
 	_logFilePath.clear();
 
-	Common::String logFile = getDefaultLogFileName();
+	Common::String logFile;
+	if (ConfMan.hasKey("logfile"))
+		logFile = ConfMan.get("logfile");
+	else
+		logFile = getDefaultLogFileName();
 	if (logFile.empty())
 		return nullptr;
 
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index b982e50cb2..01a2a54914 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -87,6 +87,9 @@ static const char HELP_STRING[] =
 #endif
 	"\n"
 	"  -c, --config=CONFIG      Use alternate configuration file\n"
+#if defined(SDL_BACKEND)
+	"  -l, --logfile=PATH       Use alternate path for log file\n"
+#endif
 	"  -p, --path=PATH          Path to where the game is installed\n"
 	"  -x, --save-slot[=NUM]    Save game slot to load (default: autosave)\n"
 	"  -f, --fullscreen         Force full-screen mode\n"
@@ -544,6 +547,11 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
 			DO_OPTION('c', "config")
 			END_OPTION
 
+#if defined(SDL_BACKEND)
+			DO_OPTION('l', "logfile")
+			END_OPTION
+#endif
+
 			DO_OPTION_INT('b', "boot-param")
 			END_OPTION
 




More information about the Scummvm-git-logs mailing list