rename the set of hashes to check for deletion

This commit is contained in:
Stephen Birarda 2016-04-11 17:16:52 -07:00
parent 026f58c866
commit 190d11e0bf

View file

@ -550,7 +550,7 @@ bool AssetServer::deleteMappings(AssetPathList& paths) {
// take a copy of the current mappings in case persistence of these deletes fails // take a copy of the current mappings in case persistence of these deletes fails
auto oldMappings = _fileMappings; auto oldMappings = _fileMappings;
QSet<QString> hashesToCheck; QSet<QString> hashesToCheckForDeletion;
// enumerate the paths to delete and remove them all // enumerate the paths to delete and remove them all
for (auto& path : paths) { for (auto& path : paths) {
@ -566,7 +566,7 @@ bool AssetServer::deleteMappings(AssetPathList& paths) {
while (it != _fileMappings.end()) { while (it != _fileMappings.end()) {
if (it.key().startsWith(path)) { if (it.key().startsWith(path)) {
// add this hash to the list we need to check for asset removal from the server // add this hash to the list we need to check for asset removal from the server
hashesToCheck << it.value().toString(); hashesToCheckForDeletion << it.value().toString();
it = _fileMappings.erase(it); it = _fileMappings.erase(it);
} else { } else {
@ -585,7 +585,7 @@ bool AssetServer::deleteMappings(AssetPathList& paths) {
auto oldMapping = _fileMappings.take(path); auto oldMapping = _fileMappings.take(path);
if (!oldMapping.isNull()) { if (!oldMapping.isNull()) {
// add this hash to the list we need to check for asset removal from server // add this hash to the list we need to check for asset removal from server
hashesToCheck << oldMapping.toString(); hashesToCheckForDeletion << oldMapping.toString();
qDebug() << "Deleted a mapping:" << path << "=>" << oldMapping.toString(); qDebug() << "Deleted a mapping:" << path << "=>" << oldMapping.toString();
} else { } else {
@ -603,14 +603,14 @@ bool AssetServer::deleteMappings(AssetPathList& paths) {
// enumerate the mapped hashes and clear the list of hashes to check for anything that's present // enumerate the mapped hashes and clear the list of hashes to check for anything that's present
for (auto& hashVariant : mappedHashes) { for (auto& hashVariant : mappedHashes) {
auto it = hashesToCheck.find(hashVariant.toString()); auto it = hashesToCheckForDeletion.find(hashVariant.toString());
if (it != hashesToCheck.end()) { if (it != hashesToCheckForDeletion.end()) {
hashesToCheck.erase(it); hashesToCheckForDeletion.erase(it);
} }
} }
// we now have a set of hashes that are unmapped - we will delete those asset files // we now have a set of hashes that are unmapped - we will delete those asset files
for (auto& hash : hashesToCheck) { for (auto& hash : hashesToCheckForDeletion) {
// remove the unmapped file // remove the unmapped file
QFile removeableFile { _filesDirectory.absoluteFilePath(hash) }; QFile removeableFile { _filesDirectory.absoluteFilePath(hash) };