diff --git a/src/io/engine_paths.cpp b/src/io/engine_paths.cpp index ca20b265..d07a919b 100644 --- a/src/io/engine_paths.cpp +++ b/src/io/engine_paths.cpp @@ -180,14 +180,16 @@ void EnginePaths::setCurrentWorldFolder(io::path folder) { void EnginePaths::setContentPacks(std::vector* 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); } } diff --git a/src/io/engine_paths.hpp b/src/io/engine_paths.hpp index fda77087..4858a215 100644 --- a/src/io/engine_paths.hpp +++ b/src/io/engine_paths.hpp @@ -53,6 +53,7 @@ private: io::path currentWorldFolder; std::optional scriptFolder; std::vector* contentPacks = nullptr; + std::vector contentEntryPoints; }; struct PathsRoot {