From 9b97d851fe7caef9c6c87ec5a073f44060112b9c Mon Sep 17 00:00:00 2001 From: James Brown Date: Sat, 7 Feb 2004 04:53:59 +0000 Subject: Add -c/--config option to specific alternate configuration file. Sorry Max, but it's damn useful for coverdiscs :) svn-id: r12758 --- common/config-manager.cpp | 11 ++++++++++- common/config-manager.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 299d3c817e..46881ecde3 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -86,6 +86,14 @@ ConfigManager::ConfigManager() { #endif #endif + switchFile(configFile); +} + +void ConfigManager::switchFile(const String &filename) { + _globalDomains.clear(); + _gameDomains.clear(); + _transientDomain.clear(); + // Ensure the global domain(s) are setup. _globalDomains.addKey(kApplicationDomain); #ifdef _WIN32_WCE @@ -94,8 +102,9 @@ ConfigManager::ConfigManager() { _globalDomains.addKey("smartfon-keys"); #endif - _filename = configFile; + _filename = filename; loadFile(_filename); + printf("Switched to configuration %s\n", _filename.c_str()); } void ConfigManager::loadFile(const String &filename) { diff --git a/common/config-manager.h b/common/config-manager.h index ddc97b76ee..ee3159fb0a 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -61,6 +61,8 @@ public: /** The transient (pseudo) domain. */ static const String kTransientDomain; + void switchFile(const String &filename); + bool hasKey(const String &key) const; bool hasKey(const String &key, const String &dom) const; -- cgit v1.2.3