[studio] Add ability to move directories
All checks were successful
Build / build (push) Successful in 3m29s
All checks were successful
Build / build (push) Successful in 3m29s
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user