Fixed a nasty order of destruction bug, where the memory pool for ScriptInts was destroyed before the PackageManager

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@20 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-12 17:08:02 +00:00
parent 6fe45ca28b
commit b13d0b81ae
13 changed files with 257 additions and 41 deletions
+11 -7
View File
@@ -11,7 +11,7 @@
// ----------------------------------------------------------------------------- : PackageManager
String programDir() {
String program_dir() {
return _("."); //TODO
}
@@ -20,18 +20,22 @@ PackageManager packages;
PackageManager::PackageManager() {
// determine data directory
dataDirectory = programDir();
data_directory = program_dir();
// check if this is the actual data directory, especially during debugging,
// the data may be higher up:
// exe path = mse/build/debug/mse.exe
// data path = mse/data
while (!wxDirExists(dataDirectory + _("/data"))) {
String d = dataDirectory;
dataDirectory = wxPathOnly(dataDirectory);
if (d == dataDirectory) {
while (!wxDirExists(data_directory + _("/data"))) {
String d = data_directory;
data_directory = wxPathOnly(data_directory);
if (d == data_directory) {
// we are at the root -> 'data' not found anywhere in the path -> fatal error
throw Error(_("The MSE data files can not be found, there should be a directory called 'data' with these files"));
}
}
dataDirectory += _("/data");
data_directory += _("/data");
}
void PackageManager::destroy() {
loaded_packages.clear();
}