diff options
-rw-r--r-- | base/main.cpp | 9 | ||||
-rw-r--r-- | common/file.cpp | 13 | ||||
-rw-r--r-- | common/file.h | 3 | ||||
-rw-r--r-- | gui/ThemeNew.cpp | 6 |
4 files changed, 10 insertions, 21 deletions
diff --git a/base/main.cpp b/base/main.cpp index cd118ade30..6eacd122f8 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -314,13 +314,8 @@ static int runGame(GameDetector &detector, OSystem &system, const Common::String if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain)) Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain)); - // Theme-related - if (ConfMan.hasKey("themepath")) { - Common::File::addDefaultDirectory(ConfMan.get("themepath")); - } - - // As a last resort add current directory and lock further additions - Common::File::addDefaultDirectory(".", true); + // As a last resort add current directory + Common::File::addDefaultDirectory("."); int result; diff --git a/common/file.cpp b/common/file.cpp index 5a50d24233..b5e2857905 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -32,7 +32,6 @@ namespace Common { StringList File::_defaultDirectories; File::FilesMap File::_filesMap; -bool File::_lockedDirectories; static FILE *fopenNoCase(const char *filename, const char *directory, const char *mode) { @@ -108,14 +107,9 @@ static FILE *fopenNoCase(const char *filename, const char *directory, const char return file; } -void File::addDefaultDirectory(const String &directory, bool lockDirectories) { +void File::addDefaultDirectory(const String &directory) { String lfn; - if (_lockedDirectories) - error("addDefaultDirectory is called too late. Move all calls to engine constructor"); - - _lockedDirectories = lockDirectories; - FilesystemNode dir(directory.c_str()); if (!dir.isDirectory()) @@ -139,9 +133,6 @@ void File::addDefaultDirectoryRecursive(const String &directory, int level, int String lfn; - if (_lockedDirectories) - error("addDefaultDirectoryRecursive is called too late. Move all calls to engine constructor"); - FilesystemNode dir(directory.c_str()); if (!dir.isDirectory()) @@ -176,12 +167,10 @@ void File::addDefaultDirectoryRecursive(const String &directory, int level, int void File::resetDefaultDirectories() { _defaultDirectories.clear(); _filesMap.clear(); - _lockedDirectories = false; } File::File() : _handle(0), _ioFailed(false), _refcount(1) { - _lockedDirectories = false; } //#define DEBUG_FILE_REFCOUNT diff --git a/common/file.h b/common/file.h index 306dc3a915..d113e7f531 100644 --- a/common/file.h +++ b/common/file.h @@ -49,7 +49,6 @@ protected: static StringList _defaultDirectories; static FilesMap _filesMap; - static bool _lockedDirectories; public: enum AccessMode { @@ -57,7 +56,7 @@ public: kFileWriteMode = 2 }; - static void addDefaultDirectory(const String &directory, bool lockDirectories = false); + static void addDefaultDirectory(const String &directory); static void addDefaultDirectoryRecursive(const String &directory, int level = 0, int baseLen = 0); static void resetDefaultDirectories(); diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp index bb822d7e6f..1db42320bc 100644 --- a/gui/ThemeNew.cpp +++ b/gui/ThemeNew.cpp @@ -131,6 +131,12 @@ _lastUsedBitMask(0), _forceRedraw(false), _font(0), _imageHandles(0), _images(0) } } + if (ConfMan.hasKey("extrapath")) + Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath")); + + if (ConfMan.hasKey("themepath")) + Common::File::addDefaultDirectory(ConfMan.get("themepath")); + ImageMan.addArchive(stylefile + ".zip"); if (!_configFile.loadFromFile(stylefile + ".ini")) { |