25 const std::filesystem::path& dest_path,
26 const std::string& name);
33 virtual std::map<int, unsigned long>
deploy(
34 std::optional<ProgressNode*> progress_node = {})
override;
41 virtual std::map<int, unsigned long>
deploy(
42 const std::vector<int>& loadorder,
43 std::optional<ProgressNode*> progress_node = {})
override;
55 virtual void setModStatus(
int mod_id,
bool status)
override;
65 virtual std::vector<std::string>
getModNames()
const override;
71 virtual void addProfile(
int source = -1)
override;
87 virtual void setConflictGroups(
const std::vector<std::vector<int>>& newConflict_groups)
override;
97 virtual std::vector<std::tuple<int, bool>>
getLoadorder()
const override;
105 virtual bool addMod(
int mod_id,
bool enabled =
true,
bool update_conflicts =
true)
override;
111 virtual bool removeMod(
int mod_id)
override;
118 virtual bool hasMod(
int mod_id)
const override;
125 virtual bool swapMod(
int old_id,
int new_id)
override;
135 bool show_disabled =
false,
136 std::optional<ProgressNode*> progress_node = {})
const override;
145 std::optional<ProgressNode*> progress_node = {})
override;
150 virtual void sortModsByConflicts(std::optional<ProgressNode*> progress_node = {})
override;
152 virtual void cleanup()
override;
157 virtual std::vector<std::vector<std::string>>
getAutoTags()
override;
169 std::optional<ProgressNode*> progress_node = {})
const override;
183 std::optional<ProgressNode*> progress_node = {})
const override;
232 std::vector<std::pair<std::string, bool>>
plugins_;
236 std::vector<std::vector<std::string>>
tags_;
289 std::string
hideFile(
const std::string& name);
DeployMode
Describes how files should be deployed to the target directory.
Definition deployer.h:27
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
virtual void cleanup() override
Deletes the config file and all profile files.
Definition plugindeployer.cpp:245
virtual std::vector< std::string > getModNames() const override
Generates a vector of names for every plugin.
Definition plugindeployer.cpp:88
virtual void setConflictGroups(const std::vector< std::vector< int > > &newConflict_groups) override
Not supported by this type.
Definition plugindeployer.cpp:156
int num_profiles_
Current number of profiles.
Definition plugindeployer.h:234
virtual bool supportsFileConflicts() const override
Returns whether or not this deployer type supports showing file conflicts.
Definition plugindeployer.cpp:303
virtual void readSourceMods()
Reads the source mods from disk.
Definition plugindeployer.cpp:505
virtual std::vector< ConflictInfo > getFileConflicts(int mod_id, bool show_disabled=false, std::optional< ProgressNode * > progress_node={}) const override
Not supported.
Definition plugindeployer.cpp:212
virtual std::map< int, unsigned long > deploy(std::optional< ProgressNode * > progress_node={}) override
Reloads all deployed plugins.
Definition plugindeployer.cpp:25
virtual void addProfile(int source=-1) override
Adds a new profile and optionally copies it's load order from an existing profile....
Definition plugindeployer.cpp:97
virtual std::vector< std::pair< std::filesystem::path, int > > getExternallyModifiedFiles(std::optional< ProgressNode * > progress_node={}) const override
Not supported by this Deployer type.
Definition plugindeployer.cpp:268
virtual bool idsAreSourceReferences() const override
Returns whether or not this deployer type uses mod ids as references to source mods....
Definition plugindeployer.cpp:313
std::string hideFile(const std::string &name)
Converts the given file name to a hidden file by prepending a ".", if necessary.
Definition plugindeployer.cpp:547
PluginDeployer(const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const std::string &name)
Constructor.
Definition plugindeployer.cpp:17
virtual void loadSettings()
Loads number of profiles and active profile from the config file.
Definition plugindeployer.cpp:395
virtual void setProfile(int profile) override
Setter for the active profile. Changes the currently active plugin files to the ones saved in the new...
Definition plugindeployer.cpp:135
std::string plugin_file_name_
Name of the file containing plugin activation status.
Definition plugindeployer.h:230
virtual void sortModsByConflicts(std::optional< ProgressNode * > progress_node={}) override
Not supported by this type.
Definition plugindeployer.cpp:236
virtual void writePluginTags() const
Writes the current tags_ to disk.
Definition plugindeployer.cpp:427
virtual void resetSettings()
Resets all settings to default values.
Definition plugindeployer.cpp:421
virtual int getDeployPriority() const override
Returns the order in which the deploy function of different deployers should be called.
Definition plugindeployer.cpp:298
std::map< std::string, int > source_mods_
Maps every plugin to a source mod, if that plugin was created by another deployer.
Definition plugindeployer.h:238
virtual void updatePluginTags()=0
Updates the plugin tags for every currently loaded plugin. Must be implemented in derived classes.
virtual void writePlugins() const
Writes current load order to plugins file.
Definition plugindeployer.cpp:372
virtual void fixInvalidLinkDeployMode() override
Since this deployer type does not use normal deployment methods, this does nothing.
Definition plugindeployer.cpp:291
virtual void removeProfile(int profile) override
Removes a profile.
Definition plugindeployer.cpp:121
static constexpr std::string EXTENSION
Appended to profile file names.
Definition plugindeployer.h:221
virtual int getNumMods() const override
Returns the number of plugins on the load order.
Definition plugindeployer.cpp:163
virtual void updateSourceMods()
Updates the source mod map with files created by another deployer.
Definition plugindeployer.cpp:457
std::optional< std::filesystem::path > getRootOfTargetDirectory(std::filesystem::path target) const
Finds the directory serving as a target directory for the deployer which manages the given target pat...
Definition plugindeployer.cpp:528
virtual bool supportsFileBrowsing() const override
Returns whether or not this deployer type supports browsing mod files.
Definition plugindeployer.cpp:308
virtual void setDeployMode(DeployMode deploy_mode) override
This deployer always uses copy deploy mode.
Definition plugindeployer.cpp:293
virtual std::map< std::string, int > getAutoTagMap() override
Returns all available auto tag names.
Definition plugindeployer.cpp:263
virtual std::vector< std::vector< int > > getConflictGroups() const override
Conflict groups are not supported by this type.
Definition plugindeployer.cpp:81
virtual bool hasMod(int mod_id) const override
Since this deployer uses its own internal mod ids, this function always returns false.
Definition plugindeployer.cpp:199
virtual std::vector< std::vector< std::string > > getAutoTags() override
Getter for mod tags.
Definition plugindeployer.cpp:258
std::vector< std::vector< std::string > > tags_
For every plugin: Every tag associated with that plugin.
Definition plugindeployer.h:236
virtual void writeSourceMods() const
Writes the source mods to disk.
Definition plugindeployer.cpp:484
virtual void keepOrRevertFileModifications(const FileChangeChoices &changes_to_keep) override
Not supported by this Deployer type.
Definition plugindeployer.cpp:279
std::vector< std::pair< std::string, bool > > plugins_
Contains names of all plugins and their activation status.
Definition plugindeployer.h:232
static constexpr std::string UNDEPLOY_BACKUP_EXTENSION
File extension for plugins.txt and loadorder.txt backup files.
Definition plugindeployer.h:223
std::regex plugin_file_line_regex_
Regex used to match against lines in the plugin file.
Definition plugindeployer.h:242
virtual std::unordered_set< int > getModConflicts(int mod_id, std::optional< ProgressNode * > progress_node={}) override
Not supported by this type.
Definition plugindeployer.cpp:225
virtual bool swapMod(int old_id, int new_id) override
Does nothing since this deployer manages its own mods.
Definition plugindeployer.cpp:204
std::regex plugin_regex_
Regex used to match against files in the source directory.
Definition plugindeployer.h:240
virtual void restoreUndeployBackupIfExists()
If plugin file backups exist, restore it and override the current file.
Definition plugindeployer.cpp:444
std::string config_file_name_
Name of the file containing settings.
Definition plugindeployer.h:225
virtual void updateDeployedFilesForMod(int mod_id, std::optional< ProgressNode * > progress_node={}) const override
Updates the deployed files for one mod to match those in the mod's source directory....
Definition plugindeployer.cpp:281
std::string tags_file_name_
Name of the file containing loot tags.
Definition plugindeployer.h:244
virtual void setModStatus(int mod_id, bool status) override
Enables or disables the given mod in the load order. Saves changes to disk.
Definition plugindeployer.cpp:73
virtual void loadPlugins()
Load plugins from the plugins file.
Definition plugindeployer.cpp:353
std::string source_mods_file_name_
Name of the file containing source mod ids for plugins.
Definition plugindeployer.h:227
virtual bool addMod(int mod_id, bool enabled=true, bool update_conflicts=true) override
Does nothing since this deployer manages its own mods.
Definition plugindeployer.cpp:183
virtual bool removeMod(int mod_id) override
Not supported by this type.
Definition plugindeployer.cpp:191
virtual std::vector< std::tuple< int, bool > > getLoadorder() const override
Getter for the current plugin load order.
Definition plugindeployer.cpp:168
virtual std::vector< std::vector< int > > getValidModActions() const override
Returns a vector containing valid mod actions.
Definition plugindeployer.cpp:318
virtual void saveSettings() const
Saves number of profiles and active profile to the config file.
Definition plugindeployer.cpp:382
virtual void updatePlugins()
Updates current plugins to reflect plugins actually in the source directory.
Definition plugindeployer.cpp:326
virtual 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 plugindeployer.cpp:46
Header for the Deployer class.
Contains data regarding which external file changes to keep.
Definition filechangechoices.h:16