API to reset the resource manager, and remove
providers. Needed to fix a bug with parsing -set.xml files in the launcher; correctly loading XML needs the resource paths to be defined.
This commit is contained in:
@@ -56,6 +56,15 @@ ResourceManager::~ResourceManager()
|
||||
std::for_each(_providers.begin(), _providers.end(),
|
||||
[](ResourceProvider* p) { delete p; });
|
||||
}
|
||||
|
||||
void ResourceManager::reset()
|
||||
{
|
||||
if (static_manager) {
|
||||
delete static_manager;
|
||||
static_manager = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* trivial provider using a fixed base path
|
||||
*/
|
||||
@@ -107,6 +116,8 @@ void ResourceManager::removeProvider(ResourceProvider* aProvider)
|
||||
SG_LOG(SG_GENERAL, SG_DEV_ALERT, "unknown provider doing remove");
|
||||
return;
|
||||
}
|
||||
|
||||
_providers.erase(it);
|
||||
}
|
||||
|
||||
SGPath ResourceManager::findPath(const std::string& aResource, SGPath aContext)
|
||||
|
||||
@@ -45,8 +45,10 @@ public:
|
||||
PRIORITY_HIGH = 1000
|
||||
} Priority;
|
||||
|
||||
static ResourceManager* instance();
|
||||
|
||||
static ResourceManager* instance();
|
||||
|
||||
static void reset();
|
||||
|
||||
/**
|
||||
* add a simple fixed resource location, to resolve against
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user