fix EnginePaths::setContentPacks

This commit is contained in:
MihailRis 2025-02-04 13:17:35 +03:00
parent bced20be1f
commit 8a12ff5879
2 changed files with 5 additions and 2 deletions

View File

@ -180,14 +180,16 @@ void EnginePaths::setCurrentWorldFolder(io::path folder) {
void EnginePaths::setContentPacks(std::vector<ContentPack>* contentPacks) {
// Remove previous content entry-points
for (const auto& pack : *this->contentPacks) {
io::remove_device(pack.id);
for (const auto& id : contentEntryPoints) {
io::remove_device(id);
}
contentEntryPoints.clear();
this->contentPacks = contentPacks;
// Create content devices
for (const auto& pack : *contentPacks) {
auto parent = pack.folder.entryPoint();
io::create_subdevice(pack.id, parent, pack.folder);
contentEntryPoints.push_back(pack.id);
}
}

View File

@ -53,6 +53,7 @@ private:
io::path currentWorldFolder;
std::optional<std::filesystem::path> scriptFolder;
std::vector<ContentPack>* contentPacks = nullptr;
std::vector<std::string> contentEntryPoints;
};
struct PathsRoot {