diff options
Diffstat (limited to 'src/installationmanager.h')
| -rw-r--r-- | src/installationmanager.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/installationmanager.h b/src/installationmanager.h index 008a0916..9eec4abc 100644 --- a/src/installationmanager.h +++ b/src/installationmanager.h @@ -31,6 +31,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <archive.h> #include <QProgressDialog> #include <set> +#include <map> #include <errorcodes.h> @@ -153,6 +154,19 @@ public: virtual QStringList extractFiles(std::vector<std::shared_ptr<const MOBase::FileTreeEntry>> const& entries) override; /** + * @brief Create a new file on the disk corresponding to the given entry. + * + * This method can be used by installer that needs to create files that are not in the original + * archive. At the end of the installation, if there are entries in the final tree that were used + * to create files, the corresponding files will be moved to the mod folder. + * + * @param entry The entry for which a temporary file should be created. + * + * @return the path to the created file. + */ + virtual QString createFile(std::shared_ptr<const MOBase::FileTreeEntry> entry) override; + + /** * @brief Installs the given archive. * * @param modName Suggested name of the mod. @@ -186,7 +200,13 @@ private: MOBase::IPluginInstaller::EInstallResult doInstall(MOBase::GuessedValue<QString> &modName, QString gameName, int modID, const QString &version, const QString &newestVersion, int categoryID, int fileCategoryID, const QString &repository); - //QString generateBackupName(const QString &directoryName) const; + /** + * @brief Clean the list of created files by removing all entries that are not + * in the given tree. + * + * @param tree The parent tree. Usually the tree returned by the installer. + */ + void cleanCreatedFiles(std::shared_ptr<const MOBase::IFileTree> fileTree); bool ensureValidModName(MOBase::GuessedValue<QString> &name) const; @@ -242,6 +262,9 @@ private: QString m_CurrentFile; QString m_ErrorMessage; + // List of creates files: + std::map<std::shared_ptr<const MOBase::FileTreeEntry>, QString> m_CreatedFiles; + QProgressDialog *m_InstallationProgress { nullptr }; int m_Progress; QString m_ProgressFile; |
