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:
James Turner
2020-06-17 11:19:20 +01:00
parent b4d5374fb7
commit aa0f02706f
2 changed files with 15 additions and 2 deletions

View File

@@ -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)

View File

@@ -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
*/