mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-24 13:07:44 +00:00
sagasu: Don't add duplicate folder nodes
This commit is contained in:
parent
4b19b7aeba
commit
b1fa058d1d
2 changed files with 16 additions and 10 deletions
|
@ -144,17 +144,23 @@ void FileTreeModel::addKnownFolder(QString string)
|
|||
conct += QStringLiteral("/") + children[i];
|
||||
}
|
||||
std::string conctStd = conct.toStdString();
|
||||
auto hash = physis_generate_partial_hash(conctStd.c_str());
|
||||
|
||||
if (knownDirHashes.contains(hash)) {
|
||||
parentItem = knownDirHashes[hash];
|
||||
} else {
|
||||
auto folderItem = new TreeInformation();
|
||||
folderItem->name = children[i];
|
||||
folderItem->type = TreeType::Folder;
|
||||
folderItem->parent = parentItem;
|
||||
folderItem->row = i + 1;
|
||||
folderItem->hash = physis_generate_partial_hash(conctStd.c_str());
|
||||
folderItem->hash = hash;
|
||||
parentItem->children.push_back(folderItem);
|
||||
parentItem = folderItem;
|
||||
knownDirHashes[folderItem->hash] = folderItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileTreeModel::addFile(TreeInformation *parentItem, uint32_t name, QString realName)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ void HashDatabase::addFile(QString file)
|
|||
filename = file.sliced(lastSlash + 1, file.length() - lastSlash - 1);
|
||||
}
|
||||
|
||||
qInfo() << filename;
|
||||
qInfo() << "Adding" << filename;
|
||||
|
||||
std::string folderStd = filename.toStdString();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue