mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
Added new feature allowing data files in the user's settings directory to override those in the default directory
It's for systems where the main data is not writable by everyone. (Unices, mainly, and potentially Windows Vista) The Windows default directory is a little out-of-the-way, in %HOME%\Application Data\Magic Set Editor\Data Maybe they should be configurable. But it also paves the way for the installer being capable of putting packages into the user's local directory. That way, users don't all have to have all the packages that the other users want. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@557 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -34,9 +34,14 @@ class PackageManager {
|
||||
/// Open a package with the specified name (including extension)
|
||||
template <typename T>
|
||||
intrusive_ptr<T> open(const String& name) {
|
||||
wxFileName fn(data_directory + _("/") + name);
|
||||
fn.Normalize();
|
||||
String filename = fn.GetFullPath();
|
||||
wxFileName loc(local_data_directory + _("/") + name);
|
||||
loc.Normalize();
|
||||
String filename = loc.GetFullPath();
|
||||
if (!wxFileExists(filename) && !wxDirExists(filename)) {
|
||||
wxFileName glob(global_data_directory + _("/") + name);
|
||||
glob.Normalize();
|
||||
filename = glob.GetFullPath();
|
||||
}
|
||||
// Is this package already loaded?
|
||||
PackagedP& p = loaded_packages[filename];
|
||||
intrusive_ptr<T> typedP = dynamic_pointer_cast<T>(p);
|
||||
@@ -70,7 +75,8 @@ class PackageManager {
|
||||
|
||||
private:
|
||||
map<String, PackagedP> loaded_packages;
|
||||
String data_directory;
|
||||
String global_data_directory;
|
||||
String local_data_directory;
|
||||
};
|
||||
|
||||
/// The global PackageManager instance
|
||||
|
||||
Reference in New Issue
Block a user