Limo
A simple mod manager
Loading...
Searching...
No Matches
Deployer Class Reference

Handles deployment of mods to target directory. More...

#include <deployer.h>

Inheritance diagram for Deployer:

Public Types

enum  DeployMode { hard_link = 0 , sym_link = 1 , copy = 2 }
 Describes how files should be deployed to the target directory. More...
 

Public Member Functions

 Deployer (const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const std::string &name, DeployMode deploy_mode=hard_link)
 Constructor.
 
std::string getDestPath () const
 Getter for path to deployment target directory.
 
std::string getSourcePath () const
 Getter for the path to the deployer's source directory.
 
std::string getName () const
 Getter for deployer name.
 
void setName (const std::string &name)
 Setter for deployer name.
 
virtual std::map< int, unsigned long > deploy (const std::vector< int > &loadorder, std::optional< ProgressNode * > progress_node={})
 Deploys all mods to the target directory using hard links. If any file already exists in the target directory, a backup for that file is created. Previously backed up files are automatically restored if no mod in the current load order overwrites them. Conflicts are handled by overwriting mods earlier in the load order with later mods.
 
virtual std::map< int, unsigned long > deploy (std::optional< ProgressNode * > progress_node={})
 Deploys all mods to the target directory using hard links. If any file already exists in the target directory, a backup for that file is created. Previously backed up files are automatically restored if no mod in the current load order overwrites them. Conflicts are handled by overwriting mods earlier in the load order with later mods. This function uses the internal load order.
 
virtual void unDeploy (std::optional< ProgressNode * > progress_node={})
 Removes all deployed mods from the target directory and restores backups.
 
void setLoadorder (const std::vector< std::tuple< int, bool > > &loadorder)
 Setter for the load order used for deployment.
 
virtual std::vector< std::tuple< int, bool > > getLoadorder () const
 Getter for the current mod load order.
 
std::string getType () const
 Returns the type of this deployer, i.e. SIMPLEDEPLOYER.
 
virtual void changeLoadorder (int from_index, int to_index)
 Moves a mod from one position in the load order to another.
 
virtual bool addMod (int mod_id, bool enabled=true, bool update_conflicts=true)
 Appends a new mod to the load order.
 
virtual bool removeMod (int mod_id)
 Removes a mod from the load order.
 
virtual void setModStatus (int mod_id, bool status)
 Enables or disables the given mod in the load order.
 
virtual bool hasMod (int mod_id) const
 Checks if given mod id is part of the load order.
 
virtual std::vector< ConflictInfogetFileConflicts (int mod_id, bool show_disabled=false, std::optional< ProgressNode * > progress_node={}) const
 Checks for file conflicts of given mod with all other mods in the load order.
 
virtual int getNumMods () const
 Returns the number of mods in the load order.
 
const std::filesystem::path & destPath () const
 Getter for path to deployment target directory.
 
void setDestPath (const std::filesystem::path &path)
 Setter for path to deployment target directory.
 
virtual std::unordered_set< int > getModConflicts (int mod_id, std::optional< ProgressNode * > progress_node={})
 Checks for conflicts with other mods. Two mods are conflicting if they share at least one file.
 
virtual void addProfile (int source=-1)
 Adds a new profile and optionally copies it's load order from an existing profile.
 
virtual void removeProfile (int profile)
 Removes a profile.
 
virtual void setProfile (int profile)
 Setter for the active profile.
 
int getProfile () const
 Getter for the active profile.
 
std::pair< int, std::string > verifyDirectories ()
 Checks if writing to the deployment directory is possible.
 
virtual bool swapMod (int old_id, int new_id)
 Replaces the given id in the load order with a new id.
 
virtual void sortModsByConflicts (std::optional< ProgressNode * > progress_node={})
 Sorts the load order by grouping mods which contain conflicting files.
 
virtual std::vector< std::vector< int > > getConflictGroups () const
 Getter for the conflict groups of the current profile.
 
virtual void setConflictGroups (const std::vector< std::vector< int > > &newConflict_groups)
 Setter for the conflict groups of the current profile.
 
DeployMode getDeployMode () const
 Getter for the current DeployMode.
 
virtual void setDeployMode (DeployMode deploy_mode)
 Sets the current DeployMode.
 
bool isAutonomous ()
 Getter for is_autonomous_.
 
virtual std::vector< std::string > getModNames () const
 Autonomous deployers override this tho provide names for their mods. Non Autonomous deployers return an empty vector.
 
std::filesystem::path sourcePath () const
 Getter for mod source path.
 
void setSourcePath (const std::filesystem::path &newSourcePath)
 Setter for mod source path.
 
void setLog (const std::function< void(Log::LogLevel, const std::string &)> &newLog)
 Setter for log callback.
 
virtual void cleanup ()
 Removes all deployed mods from the target directory and deletes the file which stores the state of this deployer.
 
void updateConflictGroups (std::optional< ProgressNode * > progress_node={})
 Updates conflict_groups_ for the current profile.
 
bool autoUpdateConflictGroups () const
 Getter for auto_update_conflict_groups_.
 
void setAutoUpdateConflictGroups (bool status)
 Setter for auto_update_conflict_groups_.
 
std::optional< bool > getModStatus (int mod_id)
 Searches the load order for the given mod id and returns the corresponding mods activation status, if found.
 
virtual std::vector< std::vector< std::string > > getAutoTags ()
 Getter for auto tags. Only implemented in autonomous deployers.
 
virtual std::map< std::string, int > getAutoTagMap ()
 Returns all available auto tag names mapped to the number of mods for that tag. Only implemented in autonomous deployers.
 
virtual std::vector< std::pair< std::filesystem::path, int > > getExternallyModifiedFiles (std::optional< ProgressNode * > progress_node={}) const
 Currently only supports hard link deployment. Checks if hard links of deployed files have been overwritten with new files.
 
virtual void keepOrRevertFileModifications (const FileChangeChoices &changes_to_keep)
 Currently only supports hard link deployment. For every given file: Moves the modified file into the source mods directory and links it back in, if the changes are to be kept. Else: Deletes that file and restores the original link.
 
virtual void updateDeployedFilesForMod (int mod_id, std::optional< ProgressNode * > progress_node={}) const
 Updates the deployed files for one mod to match those in the mod's source directory.
 
virtual void fixInvalidLinkDeployMode ()
 If using hard_link deploy mode and links cannot be created: Switch to sym links.
 
virtual int getDeployPriority () const
 Returns the order in which the deploy function of different deployers should be called.
 
virtual bool supportsSorting () const
 Returns whether or not this deployer type supports sorting mods.
 
virtual bool supportsReordering () const
 Returns whether or not this deployer type supports reordering mods.
 
virtual bool supportsModConflicts () const
 Returns whether or not this deployer type supports showing mod conflicts.
 
virtual bool supportsFileConflicts () const
 Returns whether or not this deployer type supports showing file conflicts.
 
virtual bool supportsFileBrowsing () const
 Returns whether or not this deployer type supports browsing mod files.
 
virtual bool idsAreSourceReferences () const
 Returns whether or not this deployer type uses mod ids as references to source mods. This is usually done by autonomous deployers.
 
virtual std::vector< std::pair< std::string, std::string > > getModActions () const
 Returns names and icon names for additional actions which can be applied to a mod.
 
virtual std::vector< std::vector< int > > getValidModActions () const
 Returns a vector containing valid mod actions.
 
virtual void applyModAction (int action, int mod_id)
 Applies the given mod action to the given mod.
 

Protected Member Functions

std::pair< std::map< std::filesystem::path, int >, std::map< int, unsigned long > > getDeploymentSourceFilesAndModSizes (const std::vector< int > &loadorder) const
 Creates a pair of maps. One maps relative file paths to the mod id from which that file is to be deployed. The other maps mod ids to their total file size on disk.
 
void backupOrRestoreFiles (const std::map< std::filesystem::path, int > &source_files, const std::map< std::filesystem::path, int > &dest_files) const
 Backs up all files which would be overwritten during deployment and restores all files backed up during previous deployments files which are no longer overwritten.
 
void deployFiles (const std::map< std::filesystem::path, int > &source_files, std::optional< ProgressNode * > progress_node={}) const
 Hard links all given files to target directory.
 
std::map< std::filesystem::path, int > loadDeployedFiles (std::optional< ProgressNode * > progress_node={}, std::filesystem::path dest_path="") const
 Creates a map of currently deployed files to their source mods.
 
void saveDeployedFiles (const std::map< std::filesystem::path, int > &deployed_files, std::optional< ProgressNode * > progress_node={}) const
 Creates a file containing information about currently deployed files.
 
std::vector< std::string > getModFiles (int mod_id, bool include_directories=false) const
 Creates a vector containing every file contained in one mod. Files are represented as paths relative to the mods root directory.
 
bool modPathExists (int mod_id) const
 modPathExists Checks if the directory containing the given mod exists.
 
bool checkModPathExistsAndMaybeLogError (int mod_id) const
 Checks if the directory containing the given mod exists, if not logs an error.
 
void removeManagedDirFile (const std::filesystem::path &directory) const
 Removes a legacy file that is no longer needed and may cause issues.
 

Protected Attributes

std::string type_ = "Simple Deployer"
 Type of this deployer, e.g. Simple Deployer.
 
std::filesystem::path source_path_
 Path to the directory containing all mods which are to be deployed.
 
std::filesystem::path dest_path_
 Path to the directory where all mods are deployed to.
 
const std::string backup_extension_ = ".lmmbak"
 The file extension appended to backed up files.
 
const std::string deployed_files_name_ = ".lmmfiles"
 The file name for a file in the target directory containing names of deployed files.
 
const std::string managed_dir_file_name_ = ".lmm_managed_dir"
 Name of the file indicating that the directory is managed by a deployer.
 
std::string name_
 The name of this deployer.
 
int current_profile_ = 0
 The currently active profile.
 
std::vector< std::vector< std::tuple< int, bool > > > loadorders_
 One load order per profile consisting of tuples of mod ids and their enabled status.
 
std::vector< std::vector< std::vector< int > > > conflict_groups_
 For every profile: Groups of mods which conflict with each other. The last group contains mods with no conflicts.
 
DeployMode deploy_mode_ = hard_link
 Determines how files should be deployed to the target directory.
 
bool is_autonomous_ = false
 Autonomous deployers manage their own mods and do not rely on ModdedApplication.
 
bool auto_update_conflict_groups_ = false
 If true: Automatically update conflict groups when necessary.
 
std::function< void(Log::LogLevel, const std::string &)> log_
 Callback for logging.
 

Detailed Description

Handles deployment of mods to target directory.

Member Enumeration Documentation

◆ DeployMode

Describes how files should be deployed to the target directory.

Enumerator
hard_link 

Create hard links for files.

sym_link 

Create sym links for files.

copy 

Copy files.

Constructor & Destructor Documentation

◆ Deployer()

Deployer::Deployer ( const std::filesystem::path & source_path,
const std::filesystem::path & dest_path,
const std::string & name,
DeployMode deploy_mode = hard_link )

Constructor.

Parameters
source_pathPath to directory containing mods installed using the Installer class.
dest_pathPath to target directory for mod deployment.
nameA custom name for this instance.
deploy_modeDetermines how files are deployed to the target directory.

Member Function Documentation

◆ addMod()

bool Deployer::addMod ( int mod_id,
bool enabled = true,
bool update_conflicts = true )
virtual

Appends a new mod to the load order.

Parameters
mod_idId of the mod to be added.
enabledControls if the new mod will be enabled.
update_conflictsIf true: Update mod conflict groups.
Returns
True iff the mod has been added.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ addProfile()

void Deployer::addProfile ( int source = -1)
virtual

Adds a new profile and optionally copies it's load order from an existing profile.

Parameters
sourceThe profile to be copied. A value of -1 indicates no copy.

Reimplemented in LootDeployer, PluginDeployer, and ReverseDeployer.

◆ applyModAction()

void Deployer::applyModAction ( int action,
int mod_id )
virtual

Applies the given mod action to the given mod.

Parameters
actionAction to be applied.
mod_idTarget mod.

Reimplemented in OpenMwPluginDeployer.

◆ backupOrRestoreFiles()

void Deployer::backupOrRestoreFiles ( const std::map< std::filesystem::path, int > & source_files,
const std::map< std::filesystem::path, int > & dest_files ) const
protected

Backs up all files which would be overwritten during deployment and restores all files backed up during previous deployments files which are no longer overwritten.

Parameters
source_filesA map of files to be deployed to their source mods.
dest_filesA map of files currently deployed to their source mods.

◆ changeLoadorder()

void Deployer::changeLoadorder ( int from_index,
int to_index )
virtual

Moves a mod from one position in the load order to another.

Parameters
from_indexIndex of mod to be moved.
to_indexDestination index.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ checkModPathExistsAndMaybeLogError()

bool Deployer::checkModPathExistsAndMaybeLogError ( int mod_id) const
protected

Checks if the directory containing the given mod exists, if not logs an error.

Parameters
mod_idIf of the mod to check.
Returns
True if the directory exists, else false.

◆ cleanup()

void Deployer::cleanup ( )
virtual

Removes all deployed mods from the target directory and deletes the file which stores the state of this deployer.

Reimplemented in LootDeployer, PluginDeployer, and ReverseDeployer.

◆ deploy() [1/2]

std::map< int, unsigned long > Deployer::deploy ( const std::vector< int > & loadorder,
std::optional< ProgressNode * > progress_node = {} )
virtual

Deploys all mods to the target directory using hard links. If any file already exists in the target directory, a backup for that file is created. Previously backed up files are automatically restored if no mod in the current load order overwrites them. Conflicts are handled by overwriting mods earlier in the load order with later mods.

Parameters
loadorderA vector of mod ids representing the load order.
progress_nodeUsed to inform about the current progress of deployment.
Returns
A map from deployed mod ids to their respective mods total size on disk.

Reimplemented in CaseMatchingDeployer, PluginDeployer, and ReverseDeployer.

◆ deploy() [2/2]

std::map< int, unsigned long > Deployer::deploy ( std::optional< ProgressNode * > progress_node = {})
virtual

Deploys all mods to the target directory using hard links. If any file already exists in the target directory, a backup for that file is created. Previously backed up files are automatically restored if no mod in the current load order overwrites them. Conflicts are handled by overwriting mods earlier in the load order with later mods. This function uses the internal load order.

Parameters
progress_nodeUsed to inform about the current progress of deployment.
Returns
A map from deployed mod ids to their respective mods total size on disk.

Reimplemented in CaseMatchingDeployer, PluginDeployer, and ReverseDeployer.

◆ deployFiles()

void Deployer::deployFiles ( const std::map< std::filesystem::path, int > & source_files,
std::optional< ProgressNode * > progress_node = {} ) const
protected

Hard links all given files to target directory.

Parameters
source_filesA map of files to be deployed to their source mods.
progress_nodeUsed to inform about the current progress of deployment.

◆ destPath()

const std::filesystem::path & Deployer::destPath ( ) const

Getter for path to deployment target directory.

Returns
The path.

◆ fixInvalidLinkDeployMode()

void Deployer::fixInvalidLinkDeployMode ( )
virtual

If using hard_link deploy mode and links cannot be created: Switch to sym links.

Reimplemented in PluginDeployer.

◆ getAutoTagMap()

std::map< std::string, int > Deployer::getAutoTagMap ( )
virtual

Returns all available auto tag names mapped to the number of mods for that tag. Only implemented in autonomous deployers.

Returns
The tag map.

Reimplemented in LootDeployer, OpenMwPluginDeployer, PluginDeployer, and ReverseDeployer.

◆ getAutoTags()

std::vector< std::vector< std::string > > Deployer::getAutoTags ( )
virtual

Getter for auto tags. Only implemented in autonomous deployers.

Returns
For every mod: A vector of auto tags added to that mod.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ getConflictGroups()

std::vector< std::vector< int > > Deployer::getConflictGroups ( ) const
virtual

Getter for the conflict groups of the current profile.

Returns
The conflict groups.

Reimplemented in OpenMwPluginDeployer, PluginDeployer, and ReverseDeployer.

◆ getDeploymentSourceFilesAndModSizes()

std::pair< std::map< std::filesystem::path, int >, std::map< int, unsigned long > > Deployer::getDeploymentSourceFilesAndModSizes ( const std::vector< int > & loadorder) const
protected

Creates a pair of maps. One maps relative file paths to the mod id from which that file is to be deployed. The other maps mod ids to their total file size on disk.

Parameters
loadorderThe load order used for file checks.
Returns
The generated maps.

◆ getDeployMode()

Deployer::DeployMode Deployer::getDeployMode ( ) const

Getter for the current DeployMode.

Returns
The current DeployMode.

◆ getDeployPriority()

int Deployer::getDeployPriority ( ) const
virtual

Returns the order in which the deploy function of different deployers should be called.

Returns
The priority.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ getDestPath()

std::string Deployer::getDestPath ( ) const

Getter for path to deployment target directory.

Returns
The path.

◆ getExternallyModifiedFiles()

std::vector< std::pair< sfs::path, int > > Deployer::getExternallyModifiedFiles ( std::optional< ProgressNode * > progress_node = {}) const
virtual

Currently only supports hard link deployment. Checks if hard links of deployed files have been overwritten with new files.

Parameters
progress_nodeUsed to inform about the current progress.
Returns
Path to every file that has been created via hard linking a mod and later overwritten externally and the id of the mod currently responsible for that file.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ getFileConflicts()

std::vector< ConflictInfo > Deployer::getFileConflicts ( int mod_id,
bool show_disabled = false,
std::optional< ProgressNode * > progress_node = {} ) const
virtual

Checks for file conflicts of given mod with all other mods in the load order.

Parameters
mod_idMod to be checked.
show_disabledIf true: Also check for conflicts with disabled mods.
progress_nodeUsed to inform about the current progress.
Returns
A vector with information about conflicts with every other mod.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ getLoadorder()

std::vector< std::tuple< int, bool > > Deployer::getLoadorder ( ) const
virtual

Getter for the current mod load order.

Returns
The load order.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ getModActions()

std::vector< std::pair< std::string, std::string > > Deployer::getModActions ( ) const
virtual

Returns names and icon names for additional actions which can be applied to a mod.

Returns
The actions.

Reimplemented in OpenMwPluginDeployer.

◆ getModConflicts()

std::unordered_set< int > Deployer::getModConflicts ( int mod_id,
std::optional< ProgressNode * > progress_node = {} )
virtual

Checks for conflicts with other mods. Two mods are conflicting if they share at least one file.

Parameters
mod_idThe mod to be checked.
progress_nodeUsed to inform about the current progress.
Returns
A set of mod ids which conflict with the given mod.

Reimplemented in Bg3Deployer, LootDeployer, PluginDeployer, and ReverseDeployer.

◆ getModFiles()

std::vector< std::string > Deployer::getModFiles ( int mod_id,
bool include_directories = false ) const
protected

Creates a vector containing every file contained in one mod. Files are represented as paths relative to the mods root directory.

Parameters
mod_idTarget mod.
include_directoriesIf true: Also include all directories in the mod.
Returns
The vector of files.

◆ getModNames()

std::vector< std::string > Deployer::getModNames ( ) const
virtual

Autonomous deployers override this tho provide names for their mods. Non Autonomous deployers return an empty vector.

Returns
The mod name vector.

Reimplemented in Bg3Deployer, PluginDeployer, and ReverseDeployer.

◆ getModStatus()

std::optional< bool > Deployer::getModStatus ( int mod_id)

Searches the load order for the given mod id and returns the corresponding mods activation status, if found.

Parameters
mod_idMod to be found.
Returns
The activation status, if found.

◆ getName()

std::string Deployer::getName ( ) const

Getter for deployer name.

Returns
The name.

◆ getNumMods()

int Deployer::getNumMods ( ) const
virtual

Returns the number of mods in the load order.

Returns
The number of mods.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ getProfile()

int Deployer::getProfile ( ) const

Getter for the active profile.

Returns
The profile.

◆ getSourcePath()

std::string Deployer::getSourcePath ( ) const

Getter for the path to the deployer's source directory.

Returns
The path.

◆ getType()

std::string Deployer::getType ( ) const

Returns the type of this deployer, i.e. SIMPLEDEPLOYER.

Returns
The type.

◆ getValidModActions()

std::vector< std::vector< int > > Deployer::getValidModActions ( ) const
virtual

Returns a vector containing valid mod actions.

Returns
For every mod: IDs of every valid mod_action which is valid for that mod.

Reimplemented in OpenMwPluginDeployer, PluginDeployer, and ReverseDeployer.

◆ hasMod()

bool Deployer::hasMod ( int mod_id) const
virtual

Checks if given mod id is part of the load order.

Parameters
mod_idMod to be checked.
Returns
True is mod is in load order, else false.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ idsAreSourceReferences()

bool Deployer::idsAreSourceReferences ( ) const
virtual

Returns whether or not this deployer type uses mod ids as references to source mods. This is usually done by autonomous deployers.

Returns
False

Reimplemented in PluginDeployer.

◆ keepOrRevertFileModifications()

void Deployer::keepOrRevertFileModifications ( const FileChangeChoices & changes_to_keep)
virtual

Currently only supports hard link deployment. For every given file: Moves the modified file into the source mods directory and links it back in, if the changes are to be kept. Else: Deletes that file and restores the original link.

Parameters
changes_to_keepContains paths to modified files, the id of the mod currently responsible for that file and a bool which indicates whether or not changes to that file should be kept.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ loadDeployedFiles()

std::map< sfs::path, int > Deployer::loadDeployedFiles ( std::optional< ProgressNode * > progress_node = {},
std::filesystem::path dest_path = "" ) const
protected

Creates a map of currently deployed files to their source mods.

Parameters
progress_nodeUsed to inform about the current progress.
dest_pathDirectory containing the file in which deployed file names are stored. If empty: Use the location in dest_path_ instead.
Returns
The map.

◆ modPathExists()

bool Deployer::modPathExists ( int mod_id) const
protected

modPathExists Checks if the directory containing the given mod exists.

Parameters
mod_idIf of the mod to check.
Returns
True if the directory exists, else false.

◆ removeManagedDirFile()

void Deployer::removeManagedDirFile ( const std::filesystem::path & directory) const
protected

Removes a legacy file that is no longer needed and may cause issues.

Parameters
directoryDirectory from which to remove the file.

◆ removeMod()

bool Deployer::removeMod ( int mod_id)
virtual

Removes a mod from the load order.

Parameters
mod_idId of the mod to be removed.
Returns
True iff the mod has been removed.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ removeProfile()

void Deployer::removeProfile ( int profile)
virtual

Removes a profile.

Parameters
profileThe profile to be removed.

Reimplemented in LootDeployer, PluginDeployer, and ReverseDeployer.

◆ saveDeployedFiles()

void Deployer::saveDeployedFiles ( const std::map< std::filesystem::path, int > & deployed_files,
std::optional< ProgressNode * > progress_node = {} ) const
protected

Creates a file containing information about currently deployed files.

Parameters
deployed_filesThe currently deployed files.
progress_nodeUsed to inform about the current progress.

◆ setConflictGroups()

void Deployer::setConflictGroups ( const std::vector< std::vector< int > > & newConflict_groups)
virtual

Setter for the conflict groups of the current profile.

Parameters
newConflict_groupsThe new conflict groups.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ setDeployMode()

void Deployer::setDeployMode ( DeployMode deploy_mode)
virtual

Sets the current DeployMode.

Parameters
deploy_modeThe new DeployMode.

Reimplemented in PluginDeployer.

◆ setDestPath()

void Deployer::setDestPath ( const std::filesystem::path & path)

Setter for path to deployment target directory.

Parameters
newDest_paththe new path.

◆ setLoadorder()

void Deployer::setLoadorder ( const std::vector< std::tuple< int, bool > > & loadorder)

Setter for the load order used for deployment.

Parameters
loadorderThe new load order.

◆ setLog()

void Deployer::setLog ( const std::function< void(Log::LogLevel, const std::string &)> & newLog)

Setter for log callback.

Parameters
newLogNew log callback

◆ setModStatus()

void Deployer::setModStatus ( int mod_id,
bool status )
virtual

Enables or disables the given mod in the load order.

Parameters
mod_idMod to be edited.
statusThe new status.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ setName()

void Deployer::setName ( const std::string & name)

Setter for deployer name.

Parameters
nameThe new name.

◆ setProfile()

void Deployer::setProfile ( int profile)
virtual

Setter for the active profile.

Parameters
profileThe new profile.

Reimplemented in Bg3Deployer, LootDeployer, PluginDeployer, and ReverseDeployer.

◆ setSourcePath()

void Deployer::setSourcePath ( const std::filesystem::path & newSourcePath)

Setter for mod source path.

Parameters
Newsource path.

◆ sortModsByConflicts()

void Deployer::sortModsByConflicts ( std::optional< ProgressNode * > progress_node = {})
virtual

Sorts the load order by grouping mods which contain conflicting files.

Parameters
progress_nodeUsed to inform about the current progress.

Reimplemented in LootDeployer, OpenMwPluginDeployer, PluginDeployer, and ReverseDeployer.

◆ supportsFileBrowsing()

bool Deployer::supportsFileBrowsing ( ) const
virtual

Returns whether or not this deployer type supports browsing mod files.

Returns
True if supported.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ supportsFileConflicts()

bool Deployer::supportsFileConflicts ( ) const
virtual

Returns whether or not this deployer type supports showing file conflicts.

Returns
True if supported.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ supportsModConflicts()

bool Deployer::supportsModConflicts ( ) const
virtual

Returns whether or not this deployer type supports showing mod conflicts.

Returns
True if supported.

Reimplemented in OpenMwArchiveDeployer, OpenMwPluginDeployer, and ReverseDeployer.

◆ supportsReordering()

bool Deployer::supportsReordering ( ) const
virtual

Returns whether or not this deployer type supports reordering mods.

Returns
True if supported.

Reimplemented in ReverseDeployer.

◆ supportsSorting()

bool Deployer::supportsSorting ( ) const
virtual

Returns whether or not this deployer type supports sorting mods.

Returns
True if supported.

Reimplemented in OpenMwArchiveDeployer, and ReverseDeployer.

◆ swapMod()

bool Deployer::swapMod ( int old_id,
int new_id )
virtual

Replaces the given id in the load order with a new id.

Parameters
old_idThe mod to be replaced.
new_idThe new mod.
Returns
True iff the mod has been swapped.

Reimplemented in PluginDeployer, and ReverseDeployer.

◆ unDeploy()

void Deployer::unDeploy ( std::optional< ProgressNode * > progress_node = {})
virtual

Removes all deployed mods from the target directory and restores backups.

Parameters
progress_nodeUsed to inform about the current progress.

Reimplemented in Bg3Deployer, LootDeployer, OpenMwArchiveDeployer, OpenMwPluginDeployer, and ReverseDeployer.

◆ updateConflictGroups()

void Deployer::updateConflictGroups ( std::optional< ProgressNode * > progress_node = {})

Updates conflict_groups_ for the current profile.

Parameters
progress_nodeUsed to inform about the current progress.

◆ updateDeployedFilesForMod()

void Deployer::updateDeployedFilesForMod ( int mod_id,
std::optional< ProgressNode * > progress_node = {} ) const
virtual

Updates the deployed files for one mod to match those in the mod's source directory.

Parameters
mod_idTarget mod.
progress_nodeUsed to inform about progress.

Reimplemented in CaseMatchingDeployer, PluginDeployer, and ReverseDeployer.

◆ verifyDirectories()

std::pair< int, std::string > Deployer::verifyDirectories ( )

Checks if writing to the deployment directory is possible.

Returns
A pair containing: A code indicating success(0), an IO error(1) or an error during link creation(2). A string with additional debug information.

Member Data Documentation

◆ log_

std::function<void(Log::LogLevel, const std::string&)> Deployer::log_
protected
Initial value:
const std::string& b) {}
LogLevel
Represents the importance of a log message.
Definition log.h:19

Callback for logging.


The documentation for this class was generated from the following files: