diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-05-08 21:43:27 +0200 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-05-08 21:43:27 +0200 |
| commit | 572fa7050f3dddf7a1190e07a2692a5ae9d07766 (patch) | |
| tree | 23bd6211b04e375d2ba98c022d49b8fa058ba892 /src | |
| parent | b2bd13e3db1d1469c59527fb90e763a8e42dd1f8 (diff) | |
Minor comment updates.
Diffstat (limited to 'src')
| -rw-r--r-- | src/archivefiletree.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/archivefiletree.cpp b/src/archivefiletree.cpp index c95cc3cd..96b7e42b 100644 --- a/src/archivefiletree.cpp +++ b/src/archivefiletree.cpp @@ -162,9 +162,7 @@ protected: std::vector<File> currentFiles; for (auto& p : m_Files) { - // At the start or if we have reset, just retrieve the current name and index - The - // index might not be valid in this case (e.g., if the path is a/b, the index is the - // one for a/b while we would want the one for a, but we correct that later): + // At the start or if we have reset, just retrieve the current name: if (currentName == "") { currentName = std::get<0>(p)[0]; } @@ -172,11 +170,14 @@ protected: // If the name is different, we need to create a directory from what we have // accumulated: if (currentName != std::get<0>(p)[0]) { - // No index here since this is not an empty tree: + + // We may or may not have an index here, it depends on the type of archive (some archives list + // intermediate non-empty folders, some don't): entries.push_back(std::make_shared<ArchiveFileTreeImpl>(parent, currentName, currentIndex, std::move(currentFiles))); + currentFiles.clear(); // Back to a valid state. - // Retrieve the next index: + // Reset the index: currentIndex = -1; } @@ -185,6 +186,7 @@ protected: // If the current path contains only one components: if (std::get<0>(p).size() == 1) { + // If it is not a directory, then it is a file in directly under this tree: if (!std::get<1>(p)) { entries.push_back( @@ -192,7 +194,7 @@ protected: currentName = ""; } else { - // Otherwize, it is the actual "file" corresponding to the directory, so we can retrieve + // Otherwize, it is the actual "file" corresponding to the directory we are listing, so we can retrieve // the index here: currentIndex = std::get<2>(p); } |
