Package manager for maanging the data files

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@10 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-07 16:20:19 +00:00
parent 177f1a211f
commit bbf016443d
3 changed files with 98 additions and 1 deletions
+37
View File
@@ -0,0 +1,37 @@
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/io/package_manager.hpp>
#include <util/error.hpp>
// ----------------------------------------------------------------------------- : PackageManager
String programDir() {
return _("."); //TODO
}
PackageManager packages;
PackageManager::PackageManager() {
// determine data directory
dataDirectory = programDir();
// 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) {
// 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");
}