aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2006-03-25 19:30:10 +0000
committerEugene Sandulenko2006-03-25 19:30:10 +0000
commite373c9b7b56d3b4b80ab2357363fdc4e48c97e16 (patch)
treee8932f866a6470dd6da33185defa6b2ec22b6e14
parentf25d49f826b7ddfd9ce96beca6f0b0a0a6d82a00 (diff)
downloadscummvm-rg350-e373c9b7b56d3b4b80ab2357363fdc4e48c97e16.tar.gz
scummvm-rg350-e373c9b7b56d3b4b80ab2357363fdc4e48c97e16.tar.bz2
scummvm-rg350-e373c9b7b56d3b4b80ab2357363fdc4e48c97e16.zip
- Revert my last change with moving addDefaultDirectory() from TheneNew.cpp
- Removed locking of further directory adds because it did not work for themes. svn-id: r21452
-rw-r--r--base/main.cpp9
-rw-r--r--common/file.cpp13
-rw-r--r--common/file.h3
-rw-r--r--gui/ThemeNew.cpp6
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")) {