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

sev- noreply at scummvm.org
Tue Mar 28 16:21:27 UTC 2023


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:
be98f2a812 BASE: Add default extrapath and themepahth when running in tree


Commit: be98f2a812df75902696cac9f0c66bc424054299
    https://github.com/scummvm/scummvm/commit/be98f2a812df75902696cac9f0c66bc424054299
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-03-28T18:21:21+02:00

Commit Message:
BASE: Add default extrapath and themepahth when running in tree

This means building and running scummvm in tree now works out of the box.

Unfortnatelly registering them as defaults would not work as
ConfMan::hasKey() returns false when only defined as a default, and
in most places this is checked before using those paths. So if we
wanted to use defaults we would need to replace all those checks with
a check that the path is not empty.

There is a drawback to using the session domain though: it takes
priority over all other domains. So a custom extrapath defined for
a game will be ignored. We try to mitigate the issue by only adding
those path if they exist(so that it does not break shadow builds for
example).

Also the change is excluded on Windows as it is not needed there
since the themes and engine data files are embedded in the executable.

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 5963c0445fb..cb58d51a460 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1991,6 +1991,20 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 		ConfMan.set(key, value, useSessionDomain ? Common::ConfigManager::kSessionDomain : Common::ConfigManager::kTransientDomain);
 	}
 
+	// In non-release builds, if themepath and extrapath are not defined yet, add them to the session path so that it works out
+	// of the box when building and running in tree.
+#if !defined(RELEASE_BUILD) && !defined(WIN32)
+	#define ADD_DEFAULT_PATH(key, path) \
+		if (!ConfMan.hasKey(key)) { \
+			Common::FSNode node(path); \
+			if (node.exists() && node.isDirectory() && node.isReadable()) \
+				ConfMan.set(key, path, Common::ConfigManager::kSessionDomain); \
+		}
+
+	ADD_DEFAULT_PATH("themepath", "gui/themes/")
+	ADD_DEFAULT_PATH("extrapath", "dists/engine-data/")
+#endif
+
 	return false;
 }
 




More information about the Scummvm-git-logs mailing list