[studio] Add ability to move directories
All checks were successful
Build / build (push) Successful in 3m29s

This commit is contained in:
2025-01-26 09:38:27 -06:00
parent 109e1898cc
commit 1207dadee8
10 changed files with 85 additions and 3 deletions

View File

@ -238,6 +238,9 @@ class AssetManager {
}
ox::Error updateAssetId(ox::StringViewCR oldId, ox::StringViewCR newId) noexcept final {
if (!m_cache.contains(oldId)) {
return {};
}
auto &o = m_cache[oldId];
auto &n = m_cache[newId];
n = std::move(o);
@ -246,11 +249,14 @@ class AssetManager {
}
void gc() noexcept final {
for (auto const&ack : m_cache.keys()) {
for (size_t i = 0; i < m_cache.keys().size();) {
auto const &ack = m_cache.keys()[i];
auto &ac = m_cache[ack];
if (!ac->references()) {
m_cache.erase(ack);
continue;
}
++i;
}
}
@ -309,6 +315,9 @@ class AssetManager {
if (m_fileUpdated.contains(newId)) {
return ox::Error{1, "new asset ID already has an entry"};
}
if (!m_fileUpdated.contains(oldId)) {
return {};
}
auto &o = m_fileUpdated[oldId];
auto &n = m_fileUpdated[newId];
n = std::move(o);