summaryrefslogtreecommitdiff
path: root/src/archivefiletree.cpp
diff options
context:
space:
mode:
authorAl <26797547+Al12rs@users.noreply.github.com>2020-06-01 13:56:26 -0700
committerGitHub <noreply@github.com>2020-06-01 13:56:26 -0700
commit226b2b1843bbf41581757f44f8a2f4728f0a4b19 (patch)
treeef1daf7ea519dd2bc7c9ff4ccb64b5b3a734b50b /src/archivefiletree.cpp
parenta92fdeb40064738df18d006285dfd05463d64223 (diff)
parent926267faa059082865fc3a1d62d3090645267e37 (diff)
Merge pull request #1098 from Holt59/install-manager-improvements
Installation manager improvements
Diffstat (limited to 'src/archivefiletree.cpp')
-rw-r--r--src/archivefiletree.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/archivefiletree.cpp b/src/archivefiletree.cpp
index 6ba06924..37d80537 100644
--- a/src/archivefiletree.cpp
+++ b/src/archivefiletree.cpp
@@ -84,14 +84,6 @@ protected:
public: // Overrides:
/**
- * @override
- */
- std::shared_ptr<FileTreeEntry> addFile(QString path) override {
- // Cannot add file to an archive.
- throw UnsupportedOperationException(QObject::tr("Cannot create file within an archive."));
- }
-
- /**
*
*/
static void mapToArchive(IFileTree const& tree, QString path, FileData* const* data)
@@ -118,7 +110,9 @@ public: // Overrides:
}
else {
const ArchiveFileEntry& archiveFileEntry = dynamic_cast<const ArchiveFileEntry&>(*entry);
- data[archiveFileEntry.m_Index]->addOutputFileName(path + archiveFileEntry.name());
+ if (archiveFileEntry.m_Index != -1) {
+ data[archiveFileEntry.m_Index]->addOutputFileName(path + archiveFileEntry.name());
+ }
}
}
}
@@ -135,18 +129,20 @@ public: // Overrides:
protected:
- /*
- * Overriding this to create custom FileTreeEntry with index set to -1. No need to
- * override makeFile() since we addFile is overriden. Note that this will not be
- * used to create existing tree since we do this manually in doPopulate.
+ /**
+ * Overriding makeDirectory and makeFile to create file tree or file entry with index -1.
*
- * @override
*/
virtual std::shared_ptr<IFileTree> makeDirectory(
std::shared_ptr<const IFileTree> parent, QString name) const override {
return std::make_shared<ArchiveFileTreeImpl>(parent, name, -1, std::vector<File>{});
}
+ virtual std::shared_ptr<FileTreeEntry> makeFile(
+ std::shared_ptr<const IFileTree> parent, QString name) const override {
+ return std::make_shared<ArchiveFileEntry>(parent, name, -1);
+ }
+
virtual bool doPopulate(std::shared_ptr<const IFileTree> parent, std::vector<std::shared_ptr<FileTreeEntry>>& entries) const override {
// Sort by name: