mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
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:
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user