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

Autonomous deployer which handles archive files for OpenMW. More...

#include <openmwarchivedeployer.h>

Inheritance diagram for OpenMwArchiveDeployer:
Collaboration diagram for OpenMwArchiveDeployer:

Public Member Functions

 OpenMwArchiveDeployer (const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const std::string &name)
 Loads plugins.
 
virtual void unDeploy (std::optional< ProgressNode * > progress_node={}) override
 If no backup exists: Backs up current plugin file, then reloads all plugins.
 
virtual bool supportsSorting () const override
 Returns whether or not this deployer type supports sorting mods.
 
virtual bool supportsModConflicts () const override
 Returns whether or not this deployer type supports showing mod conflicts.
 
- Public Member Functions inherited from PluginDeployer
 PluginDeployer (const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const std::string &name)
 Constructor.
 
virtual std::map< int, unsigned long > deploy (std::optional< ProgressNode * > progress_node={}) override
 Reloads all deployed plugins.
 
virtual std::map< int, unsigned long > deploy (const std::vector< int > &loadorder, std::optional< ProgressNode * > progress_node={}) override
 Reloads all deployed plugins.
 
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.
 
virtual void setModStatus (int mod_id, bool status) override
 Enables or disables the given mod in the load order. Saves changes to disk.
 
virtual std::vector< std::vector< int > > getConflictGroups () const override
 Conflict groups are not supported by this type.
 
virtual std::vector< std::string > getModNames () const override
 Generates a vector of names for every plugin.
 
virtual void addProfile (int source=-1) override
 Adds a new profile and optionally copies it's load order from an existing profile. Profiles are stored in the target directory.
 
virtual void removeProfile (int profile) override
 Removes a profile.
 
virtual void setProfile (int profile) override
 Setter for the active profile. Changes the currently active plugin files to the ones saved in the new profile.
 
virtual void setConflictGroups (const std::vector< std::vector< int > > &newConflict_groups) override
 Not supported by this type.
 
virtual int getNumMods () const override
 Returns the number of plugins on the load order.
 
virtual std::vector< std::tuple< int, bool > > getLoadorder () const override
 Getter for the current plugin load order.
 
virtual bool addMod (int mod_id, bool enabled=true, bool update_conflicts=true) override
 Does nothing since this deployer manages its own mods.
 
virtual bool removeMod (int mod_id) override
 Not supported by this type.
 
virtual bool hasMod (int mod_id) const override
 Since this deployer uses its own internal mod ids, this function always returns false.
 
virtual bool swapMod (int old_id, int new_id) override
 Does nothing since this deployer manages its own mods.
 
virtual std::vector< ConflictInfogetFileConflicts (int mod_id, bool show_disabled=false, std::optional< ProgressNode * > progress_node={}) const override
 Not supported.
 
virtual std::unordered_set< int > getModConflicts (int mod_id, std::optional< ProgressNode * > progress_node={}) override
 Not supported by this type.
 
virtual void sortModsByConflicts (std::optional< ProgressNode * > progress_node={}) override
 Not supported by this type.
 
virtual void cleanup () override
 Deletes the config file and all profile files.
 
virtual std::vector< std::vector< std::string > > getAutoTags () override
 Getter for mod tags.
 
virtual std::map< std::string, int > getAutoTagMap () override
 Returns all available auto tag names.
 
virtual std::vector< std::pair< std::filesystem::path, int > > getExternallyModifiedFiles (std::optional< ProgressNode * > progress_node={}) const override
 Not supported by this Deployer type.
 
virtual void keepOrRevertFileModifications (const FileChangeChoices &changes_to_keep) override
 Not supported by this Deployer type.
 
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. This is not supported for this deployer type.
 
virtual void fixInvalidLinkDeployMode () override
 Since this deployer type does not use normal deployment methods, this does nothing.
 
virtual void setDeployMode (DeployMode deploy_mode) override
 This deployer always uses copy deploy mode.
 
virtual int getDeployPriority () const override
 Returns the order in which the deploy function of different deployers should be called.
 
virtual bool supportsFileConflicts () const override
 Returns whether or not this deployer type supports showing file conflicts.
 
virtual bool supportsFileBrowsing () const override
 Returns whether or not this deployer type supports browsing mod files.
 
virtual bool idsAreSourceReferences () const override
 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::vector< int > > getValidModActions () const override
 Returns a vector containing valid mod actions.
 
- Public Member Functions inherited from Deployer
 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.
 
void setLoadorder (const std::vector< std::tuple< int, bool > > &loadorder)
 Setter for the load order used for deployment.
 
std::string getType () const
 Returns the type of this deployer, i.e. SIMPLEDEPLOYER.
 
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.
 
int getProfile () const
 Getter for the active profile.
 
std::pair< int, std::string > verifyDirectories ()
 Checks if writing to the deployment directory is possible.
 
DeployMode getDeployMode () const
 Getter for the current DeployMode.
 
bool isAutonomous ()
 Getter for is_autonomous_.
 
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.
 
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 bool supportsReordering () const
 Returns whether or not this deployer type supports reordering mods.
 
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 void applyModAction (int action, int mod_id)
 Applies the given mod action to the given mod.
 

Protected Member Functions

virtual void writePlugins () const override
 Writes current load order to openmw config file.
 
virtual void updatePluginTags () override
 Tags are not supported by this type.
 
bool initPluginFile ()
 Initializes the plugin file, if it does not exist.
 
- Protected Member Functions inherited from PluginDeployer
virtual void updatePlugins ()
 Updates current plugins to reflect plugins actually in the source directory.
 
virtual void loadPlugins ()
 Load plugins from the plugins file.
 
virtual void saveSettings () const
 Saves number of profiles and active profile to the config file.
 
virtual void loadSettings ()
 Loads number of profiles and active profile from the config file.
 
virtual void resetSettings ()
 Resets all settings to default values.
 
virtual void writePluginTags () const
 Writes the current tags_ to disk.
 
virtual void restoreUndeployBackupIfExists ()
 If plugin file backups exist, restore it and override the current file.
 
virtual void updateSourceMods ()
 Updates the source mod map with files created by another deployer.
 
virtual void writeSourceMods () const
 Writes the source mods to disk.
 
virtual void readSourceMods ()
 Reads the source mods from disk.
 
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 path.
 
std::string hideFile (const std::string &name)
 Converts the given file name to a hidden file by prepending a ".", if necessary.
 
- Protected Member Functions inherited from Deployer
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.
 

Static Protected Attributes

static constexpr std::string OPEN_MW_CONFIG_FILE_NAME = "openmw.cfg"
 Name of the OpenMW config file.
 
- Static Protected Attributes inherited from PluginDeployer
static constexpr std::string EXTENSION = ".lmmprof"
 Appended to profile file names.
 
static constexpr std::string UNDEPLOY_BACKUP_EXTENSION = ".undeplbak"
 File extension for plugins.txt and loadorder.txt backup files.
 

Additional Inherited Members

- Public Types inherited from Deployer
enum  DeployMode { hard_link = 0 , sym_link = 1 , copy = 2 }
 Describes how files should be deployed to the target directory. More...
 
- Protected Attributes inherited from PluginDeployer
std::string config_file_name_ = ".lmmconfig"
 Name of the file containing settings.
 
std::string source_mods_file_name_ = ".lmm_mod_sources"
 Name of the file containing source mod ids for plugins.
 
std::string plugin_file_name_ = "plugins.txt"
 Name of the file containing plugin activation status.
 
std::vector< std::pair< std::string, bool > > plugins_
 Contains names of all plugins and their activation status.
 
int num_profiles_ = 0
 Current number of profiles.
 
std::vector< std::vector< std::string > > tags_
 For every plugin: Every tag associated with that plugin.
 
std::map< std::string, int > source_mods_
 Maps every plugin to a source mod, if that plugin was created by another deployer.
 
std::regex plugin_regex_
 Regex used to match against files in the source directory.
 
std::regex plugin_file_line_regex_
 Regex used to match against lines in the plugin file.
 
std::string tags_file_name_ = ".plugin_tags"
 Name of the file containing loot tags.
 
- Protected Attributes inherited from Deployer
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

Autonomous deployer which handles archive files for OpenMW.

Constructor & Destructor Documentation

◆ OpenMwArchiveDeployer()

OpenMwArchiveDeployer::OpenMwArchiveDeployer ( const std::filesystem::path & source_path,
const std::filesystem::path & dest_path,
const std::string & name )

Loads plugins.

Parameters
source_pathPath to the directory containing installed plugins.
dest_pathPath to the directory containing openmw.cfg.
nameA custom name for this instance.

Member Function Documentation

◆ initPluginFile()

bool OpenMwArchiveDeployer::initPluginFile ( )
protected

Initializes the plugin file, if it does not exist.

Returns
A bool indicating if the plugin file was created.

◆ supportsModConflicts()

bool OpenMwArchiveDeployer::supportsModConflicts ( ) const
overridevirtual

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

Returns
False.

Reimplemented from Deployer.

◆ supportsSorting()

bool OpenMwArchiveDeployer::supportsSorting ( ) const
overridevirtual

Returns whether or not this deployer type supports sorting mods.

Returns
False.

Reimplemented from Deployer.

◆ unDeploy()

void OpenMwArchiveDeployer::unDeploy ( std::optional< ProgressNode * > progress_node = {})
overridevirtual

If no backup exists: Backs up current plugin file, then reloads all plugins.

Parameters
progress_nodeUsed to inform about the current progress.

Reimplemented from Deployer.

◆ updatePluginTags()

void OpenMwArchiveDeployer::updatePluginTags ( )
overrideprotectedvirtual

Tags are not supported by this type.

Implements PluginDeployer.

◆ writePlugins()

void OpenMwArchiveDeployer::writePlugins ( ) const
overrideprotectedvirtual

Writes current load order to openmw config file.

Reimplemented from PluginDeployer.


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