29 preserve_directories = 1 << 2,
30 single_directory = 1 << 3
34 { preserve_case, lower_case, upper_case },
35 { preserve_directories, single_directory }
39 { preserve_case,
"Preserve file names" },
40 { lower_case,
"Convert to lower case" },
41 { upper_case,
"Convert to upper case" },
42 { preserve_directories,
"Preserve directories" },
43 { single_directory,
"Root directory only" }
47 { preserve_case,
"Do not alter file names" },
48 { lower_case,
"Convert file and directory names to lower case (FiLe -> file)" },
49 { upper_case,
"Convert file and directory names to upper case (FiLe -> FILE)" },
50 { preserve_directories,
"Do not alter directory structure" },
51 { single_directory,
"Move files from all sub directories to the mods root directory" }
73 static void extract(
const std::filesystem::path& source,
74 const std::filesystem::path& destination,
75 std::optional<ProgressNode*> progress_node = {});
88 const std::filesystem::path& source,
89 const std::filesystem::path& destination,
93 const std::vector<std::pair<std::filesystem::path, std::filesystem::path>> fomod_files = {});
99 static void uninstall(
const std::filesystem::path& mod_path,
114 const std::filesystem::path& source);
149 static void copyArchive(
struct archive* source,
struct archive* dest);
159 const std::filesystem::path& dest_path,
160 std::optional<ProgressNode*> progress_node = {});
169 const std::filesystem::path& dest_path);
Holds static functions to install and uninstall mods.
Definition installer.h:21
static void copyArchive(struct archive *source, struct archive *dest)
Copies data from given source archive to given destination archive. Throws CompressionError when an r...
Definition installer.cpp:294
static void cleanupFailedInstallation(const std::filesystem::path &staging_dir, int mod_id)
Deletes all temporary files created during a previous installation attempt.
Definition installer.cpp:263
static const std::string SIMPLEINSTALLER
Simply extracts files.
Definition installer.h:54
static std::vector< std::filesystem::path > getArchiveFileNames(const std::filesystem::path &path)
Recursively reads all file and directory names from given archive.
Definition installer.cpp:212
static const std::map< Flag, std::string > OPTION_NAMES
Maps installer flags to descriptive names.
Definition installer.h:38
static unsigned long install(const std::filesystem::path &source, const std::filesystem::path &destination, int options, const std::string &type=SIMPLEINSTALLER, int root_level=0, const std::vector< std::pair< std::filesystem::path, std::filesystem::path > > fomod_files={})
Extracts the archive, performs any actions specified by the installer type, then copies all files to ...
Definition installer.cpp:61
static void extractRarArchive(const std::filesystem::path &source_path, const std::filesystem::path &dest_path)
Libarchive sometime fails to extract certain rar archives when using the method implemented in extrac...
Definition installer.cpp:424
static std::string EXTRACT_TMP_DIR
Directory name used to temporary storage of files during installation.
Definition installer.h:132
static const std::string FOMODINSTALLER
Takes a vector of files created by fomod::FomodInstaller and moves them to their target.
Definition installer.h:59
static const std::vector< std::vector< Flag > > OPTION_GROUPS
Every vector represents an exclusive group of flags.
Definition installer.h:33
static std::function< void(Log::LogLevel, const std::string &)> log
Callback for logging.
Definition installer.h:127
Flag
Flags used for installation options.
Definition installer.h:25
static void setIsAFlatpak(bool is_a_flatpak)
Sets whether this application is running as a flatpak.
Definition installer.cpp:279
static const std::vector< std::string > INSTALLER_TYPES
Contains all available installer types.
Definition installer.h:63
static void extract(const std::filesystem::path &source, const std::filesystem::path &destination, std::optional< ProgressNode * > progress_node={})
Extracts the given archive to the given directory.
Definition installer.cpp:16
static void uninstall(const std::filesystem::path &mod_path, const std::string &type=SIMPLEINSTALLER)
Uninstalls the mod at given directory using the given installer type.
Definition installer.cpp:207
static std::tuple< int, std::string, std::string > detectInstallerSignature(const std::filesystem::path &source)
Identifies the appropriate installer type from given source archive or directory.
Definition installer.cpp:235
static const std::map< Flag, std::string > OPTION_DESCRIPTIONS
Maps installer flags to brief descriptions of what they do.
Definition installer.h:46
static void throwCompressionError(struct archive *source)
Throws a CompressionError containing the error message of given archive.
Definition installer.cpp:284
static std::string MOVE_EXTENSION
Extension used for temporary storage during file movement.
Definition installer.h:134
static bool is_a_flatpak_
If true: The application is running as a flatpak.
Definition installer.h:136
static void extractWithProgress(const std::filesystem::path &source_path, const std::filesystem::path &dest_path, std::optional< ProgressNode * > progress_node={})
Extracts the given archive to the given directory. Informs about extraction progress using the provid...
Definition installer.cpp:313
Header for the Log namespace.
char path[256]
Path to which to extract the file.
Definition lspakfilelistentry.h:1
LogLevel
Represents the importance of a log message.
Definition log.h:19
Header for the ProgressNode class.