30 const std::filesystem::path& dest_path,
31 const std::string& name,
33 bool separate_profile_dirs =
false,
34 bool update_ignore_list =
false);
41 void updateManagedFiles(
bool write =
false, std::optional<ProgressNode*> progress_node = {});
48 std::map<int, unsigned long>
deploy(std::optional<ProgressNode*> progress_node = {})
override;
56 std::map<int, unsigned long>
deploy(
const std::vector<int>& loadorder,
57 std::optional<ProgressNode*> progress_node = {})
override;
62 virtual void unDeploy(std::optional<ProgressNode*> progress_node = {})
override;
84 std::vector<std::string>
getModNames()
const override;
105 void setConflictGroups(
const std::vector<std::vector<int>>& newConflict_groups)
override;
115 std::vector<std::tuple<int, bool>>
getLoadorder()
const override;
123 bool addMod(
int mod_id,
bool enabled =
true,
bool update_conflicts =
true)
override;
136 bool hasMod(
int mod_id)
const override;
143 bool swapMod(
int old_id,
int new_id)
override;
153 bool show_disabled =
false,
154 std::optional<ProgressNode*> progress_node = {})
const override;
163 std::optional<ProgressNode*> progress_node = {})
override;
182 virtual std::vector<std::vector<std::string>>
getAutoTags()
override;
195 std::optional<ProgressNode*> progress_node = {})
const override;
209 std::optional<ProgressNode*> progress_node = {})
const override;
335 const std::unordered_set<std::filesystem::path>& deployed_files,
336 std::filesystem::path current_deployer_path,
337 bool update_ignored_files =
false,
338 std::optional<ProgressNode*> progress_node = {});
351 std::filesystem::path
getSourcePath(
const std::filesystem::path&
path,
int profile)
const;
DeployMode
Describes how files should be deployed to the target directory.
Definition deployer.h:27
@ hard_link
Create hard links for files.
Definition deployer.h:29
std::string getSourcePath() const
Getter for the path to the deployer's source directory.
Definition deployer.cpp:30
Deployer(const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const std::string &name, DeployMode deploy_mode=hard_link)
Constructor.
Definition deployer.cpp:18
void setModStatus(int mod_id, bool status) override
Enables or disables the given mod in the load order. Saves changes to disk.
Definition reversedeployer.cpp:112
virtual void keepOrRevertFileModifications(const FileChangeChoices &changes_to_keep) override
For all given files: If change is to be kept: Delete the file, else: Restore the file.
Definition reversedeployer.cpp:338
virtual int getDeployPriority() const override
Returns the order in which the deploy function of different deployers should be called.
Definition reversedeployer.cpp:521
std::unordered_set< int > getModConflicts(int mod_id, std::optional< ProgressNode * > progress_node={}) override
Checks for conflicts with other mods. Two mods are conflicting if they share at least one record.
Definition reversedeployer.cpp:255
std::vector< std::pair< std::filesystem::path, bool > > current_loadorder_
Contains all files and their enabled status for the current load order.
Definition reversedeployer.h:300
void writeIgnoredFiles() const
Writes the list of ignored files to disk.
Definition reversedeployer.cpp:597
void addProfile(int source=-1) override
Adds a new profile and optionally copies it's load order from an existing profile....
Definition reversedeployer.cpp:138
int updateFilesInDir(const std::filesystem::path &target_dir, const std::unordered_set< std::filesystem::path > &deployed_files, std::filesystem::path current_deployer_path, bool update_ignored_files=false, std::optional< ProgressNode * > progress_node={})
Recursively adds all files not ignored or handled by other deployers in dir to profile_files_ for the...
Definition reversedeployer.cpp:674
std::vector< std::string > getIgnoredFiles() const
Returns a vector containing the ignored files.
Definition reversedeployer.cpp:437
std::map< int, unsigned long > deploy(std::optional< ProgressNode * > progress_node={}) override
Updates all managed files and links / unlinks files depending on whether or not they are disabled.
Definition reversedeployer.cpp:50
void moveFilesFromTargetToSource() const
Moves all managed files from dest_path_ to source_path_.
Definition reversedeployer.cpp:744
void updateIgnoredFiles(bool write=false)
Adds all files currently in the target directory and not managed by another deployer to the list of i...
Definition reversedeployer.cpp:408
virtual bool supportsReordering() const override
Returns whether or not this deployer type supports reordering mods.
Definition reversedeployer.cpp:531
int getNumMods() const override
Returns the number of managed files.
Definition reversedeployer.cpp:192
virtual void updateDeployedFilesForMod(int mod_id, std::optional< ProgressNode * > progress_node={}) const override
This is not supported for this deployer type.
Definition reversedeployer.cpp:398
void addModToIgnoreList(int mod_id)
Adds the file matching the given position in the current loadorder to the ignore list.
Definition reversedeployer.cpp:551
virtual void unDeploy(std::optional< ProgressNode * > progress_node={}) override
Unlinks all managed files.
Definition reversedeployer.cpp:86
void changeLoadorder(int from_index, int to_index) override
Moves a mod from one position in the load order to another. Saves changes to disk.
Definition reversedeployer.cpp:100
int number_of_files_in_target_
The total number of files in the target directory during previous deployment.
Definition reversedeployer.h:315
virtual bool supportsModConflicts() const override
Returns whether or not this deployer type supports showing mod conflicts.
Definition reversedeployer.cpp:536
void readIgnoredFiles()
Reads a list of ignored files from the ignore list file.
Definition reversedeployer.cpp:584
bool removeMod(int mod_id) override
Not supported by this type.
Definition reversedeployer.cpp:214
void setConflictGroups(const std::vector< std::vector< int > > &newConflict_groups) override
Not supported by this type.
Definition reversedeployer.cpp:190
void removeProfile(int profile) override
Removes a profile.
Definition reversedeployer.cpp:150
bool usesSeparateDirs() const
Returns whether or not each profile uses a separate directory to store files.
Definition reversedeployer.cpp:506
virtual std::map< std::string, int > getAutoTagMap() override
Returns all available auto tag names.
Definition reversedeployer.cpp:292
void updateManagedFiles(bool write=false, std::optional< ProgressNode * > progress_node={})
Scans the target directory for files not managed by other deployers.
Definition reversedeployer.cpp:38
std::vector< std::vector< int > > getConflictGroups() const override
Conflict groups are not supported by this type.
Definition reversedeployer.cpp:122
void sortModsByConflicts(std::optional< ProgressNode * > progress_node={}) override
Sorting is not supported.
Definition reversedeployer.cpp:266
std::unordered_set< std::string > ignored_files_
Contains all files which should be ignored by this deployer.
Definition reversedeployer.h:304
int getNumProfiles() const
Returns the number of profiles.
Definition reversedeployer.cpp:516
const int deploy_priority_
Determines the order in which the deploy function of different deployers should be called.
Definition reversedeployer.h:313
void updateCurrentLoadorder()
Updates current_loadorder_ to reflect managed_files_[current_profile_].
Definition reversedeployer.cpp:793
ReverseDeployer(const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const std::string &name, DeployMode deploy_mode=hard_link, bool separate_profile_dirs=false, bool update_ignore_list=false)
Constructor.
Definition reversedeployer.cpp:16
virtual bool supportsFileConflicts() const override
Returns whether or not this deployer type supports showing file conflicts.
Definition reversedeployer.cpp:541
bool hasMod(int mod_id) const override
Since this deployer uses its own internal mod ids, this function always returns false.
Definition reversedeployer.cpp:228
void cleanup() override
Moves all files back to their original location.
Definition reversedeployer.cpp:275
std::vector< ConflictInfo > getFileConflicts(int mod_id, bool show_disabled=false, std::optional< ProgressNode * > progress_node={}) const override
Not supported.
Definition reversedeployer.cpp:242
int deployed_profile_
Currently deployed profile.
Definition reversedeployer.h:306
bool swapMod(int old_id, int new_id) override
Does nothing since this deployer manages its own mods.
Definition reversedeployer.cpp:233
void enableSeparateDirs(bool enabled)
Enables/ disables separate managed files directories for every profile.
Definition reversedeployer.cpp:446
std::vector< std::tuple< int, bool > > getLoadorder() const override
Getter for the current plugin load order.
Definition reversedeployer.cpp:197
const std::string deployed_loadorder_name_
Name of the file containing the currently deployed load order.
Definition reversedeployer.h:296
std::optional< bool > getModStatus(int mod_id)
Searches the load order for the given mod id and returns the corresponding mods activation status,...
Definition reversedeployer.cpp:282
std::vector< std::pair< std::filesystem::path, bool > > deployed_loadorder_
Contains all files and their enabled status for the currently deployed load order.
Definition reversedeployer.h:302
virtual std::vector< std::vector< std::string > > getAutoTags() override
Getter for mod tags.
Definition reversedeployer.cpp:287
virtual std::vector< std::vector< int > > getValidModActions() const override
Returns a vector containing valid mod actions.
Definition reversedeployer.cpp:576
virtual std::vector< std::pair< std::filesystem::path, int > > getExternallyModifiedFiles(std::optional< ProgressNode * > progress_node={}) const override
Iterates over all deployed files in the source and target directory and checks if they have been dele...
Definition reversedeployer.cpp:297
void deployManagedFiles()
Uses the operation specified in deploy mode to copy/ link files from source to target.
Definition reversedeployer.cpp:815
int getNumIgnoredFiles() const
Returns the number of files in the ignore list.
Definition reversedeployer.cpp:511
void readManagedFiles()
Reads all files for every profile from a file in source_path_.
Definition reversedeployer.cpp:610
const std::string ignore_list_file_name_
Name of the file containing paths of ignored files.
Definition reversedeployer.h:292
virtual bool supportsFileBrowsing() const override
Returns whether or not this deployer type supports browsing mod files.
Definition reversedeployer.cpp:546
std::vector< std::map< std::filesystem::path, bool > > managed_files_
For every profile: A vector containing every file that is not to be deployed.
Definition reversedeployer.h:298
bool addMod(int mod_id, bool enabled=true, bool update_conflicts=true) override
Does nothing since this deployer manages its own mods.
Definition reversedeployer.cpp:206
void deleteFile(const std::filesystem::path &path, int profile)
Deletes the given file from disk and the given profile. If separate directories are NOT used: Deletes...
Definition reversedeployer.cpp:854
void writeManagedFiles() const
Writes all files for every profile to a file in source_path_.
Definition reversedeployer.cpp:642
const std::string managed_files_name_
Name of the file containing file paths and activation status for every profile.
Definition reversedeployer.h:294
void deleteIgnoredFiles()
Removes all currently ignored files from the list.
Definition reversedeployer.cpp:417
virtual bool supportsSorting() const override
Returns whether or not this deployer type supports sorting mods.
Definition reversedeployer.cpp:526
bool separate_profile_dirs_
If true: Store files on a per profile basis. Else: All profiles use the same files.
Definition reversedeployer.h:308
void setProfile(int profile) override
Sets the current profile to the given profile. Updates the current loadorder.
Definition reversedeployer.cpp:182
std::vector< std::string > getModNames() const override
Returns the vector of managed files.
Definition reversedeployer.cpp:129
Header for the Deployer class.
char path[256]
Path to which to extract the file.
Definition lspakfilelistentry.h:1
Contains data regarding which external file changes to keep.
Definition filechangechoices.h:16