![]() |
Limo
A simple mod manager
|
Contains all mods and Deployer objects used for one target application. Stores internal state in a JSON file. More...
#include <moddedapplication.h>
Public Member Functions | |
ModdedApplication (std::filesystem::path staging_dir, std::string name="", std::string command="", std::filesystem::path icon_path="", std::string app_version="") | |
If a JSON settings file already exists in app_mod_dir, it is used to construct this object. | |
void | deployMods () |
Deploys mods using all Deployer objects of this application. | |
void | deployModsFor (std::vector< int > deployers) |
Deploys mods using Deployer objects with given ids. | |
void | unDeployMods () |
Undeploys mods for all managed deployers. | |
void | unDeployModsFor (std::vector< int > deployers) |
Undeploys mods for the given deployers. | |
void | installMod (const AddModInfo &info) |
Installs a new mod using the given Installer type. | |
void | uninstallMods (const std::vector< int > &mod_ids, const std::string &installer_type="") |
Uninstalls the given mods, this includes deleting all installed files. | |
void | changeLoadorder (int deployer, int from_index, int to_index) |
Moves a mod from one position in the load order to another for given Deployer. | |
void | addModToDeployer (int deployer, int mod_id, bool update_conflicts=true, std::optional< ProgressNode * > progress_node={}) |
Appends a new mod to the load order for given Deployer. | |
void | removeModFromDeployer (int deployer, int mod_id, bool update_conflicts=true, std::optional< ProgressNode * > progress_node={}) |
Removes a mod from the load order for given Deployer. | |
void | setModStatus (int deployer, int mod_id, bool status) |
Enables or disables the given mod in the load order for given Deployer. | |
void | addDeployer (const EditDeployerInfo &info) |
Adds a new Deployer of given type. | |
void | removeDeployer (int deployer, bool cleanup) |
Removes a Deployer. | |
std::vector< std::string > | getDeployerNames () const |
Creates a vector containing the names of all Deployer objects. | |
std::vector< ModInfo > | getModInfo () const |
Creates a vector containing information about all installed mods, stored in ModInfo objects. | |
std::vector< std::tuple< int, bool > > | getLoadorder (int deployer) const |
Getter for the current mod load order of one Deployer. | |
const std::filesystem::path & | getStagingDir () const |
Getter for the path to the staging directory. This is where all installed mods are stored. | |
void | setStagingDir (std::string staging_dir, bool move_existing) |
Setter for the path to the staging directory. This is where all installed mods are stored. | |
const std::string & | name () const |
Getter for the name of this application. | |
void | setName (const std::string &newName) |
Setter for the name of this application. | |
int | getNumDeployers () const |
Returns the number of Deployer objects for this application. | |
const std::string & | getConfigFileName () const |
Getter for the name of the file used to store this objects internal state. | |
void | changeModName (int mod_id, const std::string &new_name) |
Changes the name of an installed mod. | |
std::vector< ConflictInfo > | getFileConflicts (int deployer, int mod_id, bool show_disabled) const |
Checks for file conflicts of given mod with all other mods in the load order for one Deployer. | |
AppInfo | getAppInfo () const |
Fills an AppInfo object with information about this object. | |
void | addTool (const Tool &tool) |
Adds a new tool to this application. | |
void | removeTool (int tool_id) |
Removes a tool. | |
std::vector< Tool > | getTools () const |
Getter for the tools of this application. | |
const std::string & | command () const |
Getter for the command used to run this application. | |
void | setCommand (const std::string &newCommand) |
Setter for the command used to run this application. | |
void | editDeployer (int deployer, const EditDeployerInfo &info) |
Used to set type, name and target directory for one deployer. | |
std::unordered_set< int > | getModConflicts (int deployer, int mod_id) |
Checks for conflicts with other mods for one Deployer. Two mods are conflicting if they share at least one file. | |
void | setProfile (int profile) |
Sets the currently active profile. | |
void | addProfile (const EditProfileInfo &info) |
Adds a new profile and optionally copies it's load order from an existing profile. | |
void | removeProfile (int profile) |
Removes a profile. | |
std::vector< std::string > | getProfileNames () const |
Returns a vector containing the names of all profiles. | |
void | editProfile (int profile, const EditProfileInfo &info) |
Used to set the name of a profile. | |
void | editTool (int tool_id, const Tool &new_tool) |
Used to replace an existing tool with a new tool. | |
std::tuple< int, std::string, std::string > | verifyDeployerDirectories () |
Checks if files can be deployed. | |
void | addModToGroup (int mod_id, int group, std::optional< ProgressNode * > progress_node={}) |
Adds a mod to an existing group and makes the mod the active member of that group. | |
void | removeModFromGroup (int mod_id, bool update_conflicts=true, std::optional< ProgressNode * > progress_node={}) |
Removes a mod from it's group. | |
void | createGroup (int first_mod_id, int second_mod_id, std::optional< ProgressNode * > progress_node={}) |
Creates a new group containing the two given mods. A group is a set of mods where only one member, the active member, will be deployed. | |
void | changeActiveGroupMember (int group, int mod_id, std::optional< ProgressNode * > progress_node={}) |
Changes the active member of given group to given mod. | |
void | changeModVersion (int mod_id, const std::string &new_version) |
Sets the given mod's version to the given new version. | |
int | getNumGroups () |
Returns the number of groups. | |
bool | modHasGroup (int mod_id) |
Checks if given mod belongs to any group. | |
int | getModGroup (int mod_id) |
Returns the group to which the given mod belongs. | |
void | sortModsByConflicts (int deployer) |
Sorts the load order by grouping mods which contain conflicting files. | |
std::vector< std::vector< int > > | getConflictGroups (int deployer) |
Returns the conflicts groups for the current profile of given deployer. | |
void | updateModDeployers (const std::vector< int > &mod_ids, const std::vector< bool > &deployers) |
Updates which deployer should manage given mods. | |
std::filesystem::path | iconPath () const |
Getter for icon_path_. | |
void | setIconPath (const std::filesystem::path &icon_path) |
Setter for icon_path_. | |
void | extractArchive (const std::filesystem::path &source, const std::filesystem::path &target) |
Extracts the given archive to the given location. | |
DeployerInfo | getDeployerInfo (int deployer) |
Creates DeployerInfo for one Deployer. | |
void | setLog (const std::function< void(Log::LogLevel, const std::string &)> &newLog) |
Setter for log callback. | |
void | addBackupTarget (const std::filesystem::path &path, const std::string &name, const std::vector< std::string > &backup_names) |
Adds a new target file or directory to be managed by the BackupManager. | |
void | removeBackupTarget (int target_id) |
Removes the given backup target by deleting all backups, except for the active one, and all config files. | |
void | removeAllBackupTargets () |
Removes all targets by deleting all backups, except for the active ones, and all config files. | |
void | addBackup (int target_id, const std::string &name, int source) |
Adds a new backup for the given target by copying the currently active backup. | |
void | removeBackup (int target_id, int backup_id) |
Deletes the given backup for given target. | |
void | setActiveBackup (int target_id, int backup_id) |
Changes the currently active backup for the given target. | |
std::vector< BackupTarget > | getBackupTargets () const |
Returns a vector containing information about all managed backup targets. | |
void | setBackupName (int target_id, int backup_id, const std::string &name) |
Changes the name of the given backup for the given target. | |
void | setBackupTargetName (int target_id, const std::string &name) |
Changes the name of the given backup target. | |
void | overwriteBackup (int target_id, int source_backup, int dest_backup) |
Deletes all files in the dest backup and replaces them with the files from the source backup. | |
void | cleanupFailedInstallation () |
Performs a cleanup for the previous installation. | |
void | setProgressCallback (const std::function< void(float)> &progress_callback) |
Sets the callback function used to inform about the current task's progress. | |
void | uninstallGroupMembers (const std::vector< int > &mod_ids) |
Uninstalls all mods which are inactive group members of any group which contains any of the given mods. | |
void | addManualTag (const std::string &tag_name) |
Adds a new tag with the given name. Fails if a tag by that name already exists. | |
void | removeManualTag (const std::string &tag_name, bool update_map=true) |
Removes the tag with the given name, if it exists. | |
void | changeManualTagName (const std::string &old_name, const std::string &new_name, bool update_map=true) |
Changes the name of the given tag to the given new name. Fails if a tag by the given name exists. | |
void | addTagsToMods (const std::vector< std::string > &tag_names, const std::vector< int > &mod_ids) |
Adds the given tags to all given mods. | |
void | removeTagsFromMods (const std::vector< std::string > &tag_names, const std::vector< int > &mod_ids) |
Removes the given tags from the given mods. | |
void | setTagsForMods (const std::vector< std::string > &tag_names, const std::vector< int > mod_ids) |
Sets the tags for all given mods to the given tags. | |
void | editManualTags (const std::vector< EditManualTagAction > &actions) |
Performs the given editing actions on the manual tags. | |
void | addAutoTag (const std::string &tag_name, const std::string &expression, const std::vector< TagCondition > &conditions, bool update) |
Adds a new auto tag. | |
void | addAutoTag (const Json::Value &json_tag, bool update) |
Adds a new auto tag from the given Json object. | |
void | removeAutoTag (const std::string &tag_name, bool update) |
Removes the given auto tag. | |
void | renameAutoTag (const std::string &old_name, const std::string &new_name, bool update) |
Changes the name of the given auto tag to the given new name. Fails if a tag by the given name exists. | |
void | changeAutoTagEvaluator (const std::string &tag_name, const std::string &expression, const std::vector< TagCondition > &conditions, bool update) |
Changes the given tags evaluator according to the given expression and conditions. | |
void | editAutoTags (const std::vector< EditAutoTagAction > &actions) |
Performs the given editing actions on the auto tags. | |
void | reapplyAutoTags () |
Reapply all auto tags to all mods. | |
void | updateAutoTags (const std::vector< int > mod_ids) |
Reapplies auto tags to the specified mods. | |
void | deleteAllData () |
Deletes all data for this app. | |
void | setAppVersion (const std::string &app_version) |
Sets the app version of the currently active profile to the given version. | |
void | setModSources (int mod_id, const std::string &local_source, const std::string &remote_source) |
Sets the given mods local and remote sources to the given paths. | |
nexus::Page | getNexusPage (int mod_id) |
Fetches data from NexusMods for the given mod. | |
void | checkForModUpdates () |
Checks for updates for all mods. | |
void | checkModsForUpdates (const std::vector< int > &mod_ids) |
Checks for updates for mods with the given ids. | |
void | suppressUpdateNotification (const std::vector< int > &mod_ids) |
Temporarily disables update notifications for the given mods. This is done by setting the mods remote_update_time to the installation_time. | |
std::string | getDownloadUrl (const std::string &nxm_url) |
Generates a download URL from the given NexusMods nxm Url. | |
std::string | getDownloadUrlForFile (int nexus_file_id, const std::string &mod_url) |
Generates a download URL from the given NexusMods mod id and file id. | |
std::string | getNexusPageUrl (const std::string &nxm_url) |
Generates a NexusMods mod page URL from the given nxm URL. | |
std::string | downloadMod (const std::string &url, std::function< void(float)> progress_callback) |
Downloads the file from the given url to staging_dir_ / _download. | |
ExternalChangesInfo | getExternalChanges (int deployer) |
Checks if files deployed by the given deployer have been externally overwritten. | |
void | keepOrRevertFileModifications (int deployer, const FileChangeChoices &changes_to_keep) const |
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. | |
void | fixInvalidHardLinkDeployers () |
For all deployers: If using hard links that can't be created, switch to sym links. | |
void | exportConfiguration (const std::vector< int > &deployers, const std::vector< std::string > &auto_tags) |
Exports configurations for the given deployers and the given auto tags to a json file. Does not include mods. | |
void | updateIgnoredFiles (int deployer) |
Updates the file ignore list for ReverseDeployers. | |
void | addModToIgnoreList (int deployer, int mod_id) |
Adds the given mod to the ignore list of the given ReverseDeployer. | |
void | applyModAction (int deployer, int action, int mod_id) |
Applies the given mod action to the given mod. | |
Static Public Member Functions | |
static int | verifyStagingDir (std::filesystem::path staging_dir) |
Verifies if reading/ writing to the staging directory is possible and if the JSON file containing information about installed mods can be parsed. | |
Static Public Attributes | |
static const std::string | CONFIG_FILE_NAME = "lmm_mods.json" |
Name of the file used to store this objects internal state. | |
Private Member Functions | |
void | updateSettings (bool write=false) |
Updates json_settings_ with the current state of this object. | |
void | writeSettings () const |
Writes json_settings_ to a file at app_mod_dir_/CONFIG_FILE_NAME. | |
void | readSettings () |
Reads json_settings_ from a file at app_mod_dir_/CONFIG_FILE_NAME. | |
void | updateState (bool read=false) |
Updates the internal state of this object to the state stored in json_settings_. | |
std::string | getModName (int mod_id) const |
Returns the name of a mod. | |
void | updateDeployerGroups (std::optional< ProgressNode * > progress_node={}) |
Updates the load order for every Deployer to reflect the current mod groups. | |
void | splitMod (int mod_id, int deployer) |
If given mod contains a sub-directory managed by a deployer that is not the given deployer, creates a new mod which contains that sub-directory. | |
void | replaceMod (const AddModInfo &info) |
Replaces an existing mod with the mod specified by the given argument. | |
void | updateManualTagMap () |
Updates manual_tag_map_ with the information contained in manual_tags_. | |
void | updateAutoTagMap () |
Updates auto_tag_map_ with the information contained in auto_tags_. | |
void | performUpdateCheck (const std::vector< int > &target_mod_indices) |
Checks for available updates for mods with the given index in installed_mods_. | |
std::string | generalizeSteamPath (const std::string &path) |
Checks if the given path belongs to a steam installation or prefix directory. Replaces installation or prefix path components with tokens. | |
void | updateSteamIconPath () |
If the icon path is a steam path: Update it to the new format. | |
Private Attributes | |
std::string | name_ |
The name of this application. | |
Json::Value | json_settings_ |
Contains the internal state of this object. | |
std::filesystem::path | staging_dir_ |
The path to the staging directory containing all installed mods. | |
std::vector< Mod > | installed_mods_ |
Contains all currently installed mods. | |
std::vector< std::unique_ptr< Deployer > > | deployers_ |
Contains every Deployer used by this application. | |
std::vector< Tool > | tools_ |
Contains all tools for this application. | |
std::string | command_ = "" |
The command used to run this application. | |
int | current_profile_ = 0 |
The currently active profile id. | |
std::vector< std::string > | profile_names_ |
Contains names of all profiles. | |
std::vector< std::vector< int > > | groups_ |
For every group: A vector containing every mod in that group. | |
std::map< int, int > | group_map_ |
Maps mods to their groups. | |
std::vector< int > | active_group_members_ |
Contains the active member of every group. | |
std::map< int, std::string > | installer_map_ |
Maps mods to the installer used during their installation. | |
std::filesystem::path | icon_path_ |
Path to this applications icon. | |
std::function< void(Log::LogLevel, const std::string &)> | log_ |
Callback for logging. | |
BackupManager | bak_man_ |
Manages all backups for this application. | |
int | last_mod_id_ = -1 |
Id of the most recently installed mod. | |
std::vector< ManualTag > | manual_tags_ |
Contains all known manually managed tags. | |
std::map< int, std::vector< std::string > > | manual_tag_map_ |
Maps mod ids to a vector of manual tags associated with that mod. | |
std::vector< AutoTag > | auto_tags_ |
Contains all known auto tags. | |
std::map< int, std::vector< std::string > > | auto_tag_map_ |
Maps mod ids to a vector of auto tags associated with that mod. | |
std::vector< std::string > | app_versions_ |
For every profile: The version of the app managed by that profile. | |
std::function< void(float)> | progress_callback_ = [](float f) {} |
Callback used to inform about the current task's progress. | |
std::string | download_dir_ = "_download" |
The subdirectory used to store downloads. | |
std::string | export_file_name = "exported_config" |
File name used to store exported deployers and auto tags. | |
Contains all mods and Deployer objects used for one target application. Stores internal state in a JSON file.
ModdedApplication::ModdedApplication | ( | std::filesystem::path | staging_dir, |
std::string | name = "", | ||
std::string | command = "", | ||
std::filesystem::path | icon_path = "", | ||
std::string | app_version = "" ) |
If a JSON settings file already exists in app_mod_dir, it is used to construct this object.
staging_dir | Path to staging directory where all installed mods are stored. |
name | Name of target application. |
command | Command used to run target application. |
icon_path | Path to an icon for this application. |
Json::LogicError | Indicates a logic error, e.g. trying to convert "123" to a bool, while parsing. |
Json::RuntimeError | Indicates a syntax error in the JSON file. |
ParseError | Indicates a semantic error while parsing the JSON file, e.g. the active member of a group is not part of that group. |
void ModdedApplication::addAutoTag | ( | const Json::Value & | json_tag, |
bool | update ) |
Adds a new auto tag from the given Json object.
json_tag | Json object representing the new auto tag. |
update | If true: Update the auto tag map and the settings. |
std::runtime_error | If a tag by that name exists. |
void ModdedApplication::addAutoTag | ( | const std::string & | tag_name, |
const std::string & | expression, | ||
const std::vector< TagCondition > & | conditions, | ||
bool | update ) |
Adds a new auto tag.
name | The new tags name. |
expression | Expression used for the new tags evaluator. |
conditions | Conditions used for the new tags evaluator. |
update | If true: Update the auto tag map and the settings. |
std::runtime_error | If a tag by that name exists. |
void ModdedApplication::addBackup | ( | int | target_id, |
const std::string & | name, | ||
int | source ) |
Adds a new backup for the given target by copying the currently active backup.
target_id | Target for which to create a new backup. |
name | Display name for the new backup. |
source | Backup from which to copy files to create the new backup. If -1: copy currently active backup. |
void ModdedApplication::addBackupTarget | ( | const std::filesystem::path & | path, |
const std::string & | name, | ||
const std::vector< std::string > & | backup_names ) |
Adds a new target file or directory to be managed by the BackupManager.
path | Path to the target file or directory. |
name | Display name for this target. |
backup_names | Display names for initial backups. Must contain at least one. |
void ModdedApplication::addDeployer | ( | const EditDeployerInfo & | info | ) |
Adds a new Deployer of given type.
info | Contains all data needed to create a deployer, e.g. its name. |
void ModdedApplication::addManualTag | ( | const std::string & | tag_name | ) |
Adds a new tag with the given name. Fails if a tag by that name already exists.
tag_name | Name for the new tag. |
std::runtime_error | If a tag by that name exists. |
void ModdedApplication::addModToDeployer | ( | int | deployer, |
int | mod_id, | ||
bool | update_conflicts = true, | ||
std::optional< ProgressNode * > | progress_node = {} ) |
void ModdedApplication::addModToGroup | ( | int | mod_id, |
int | group, | ||
std::optional< ProgressNode * > | progress_node = {} ) |
Adds a mod to an existing group and makes the mod the active member of that group.
mod_id | The mod's id. |
group | The target group. |
progress_node | Used to inform about the current progress. |
void ModdedApplication::addModToIgnoreList | ( | int | deployer, |
int | mod_id ) |
Adds the given mod to the ignore list of the given ReverseDeployer.
deployer | Target deployer. |
mod_id | Mod to be ignored. |
void ModdedApplication::addProfile | ( | const EditProfileInfo & | info | ) |
Adds a new profile and optionally copies it's load order from an existing profile.
info | Contains the data for the new profile. |
void ModdedApplication::addTagsToMods | ( | const std::vector< std::string > & | tag_names, |
const std::vector< int > & | mod_ids ) |
Adds the given tags to all given mods.
tag_name | Target tags name. |
mod_ids | Target mod ids. |
void ModdedApplication::addTool | ( | const Tool & | tool | ) |
Adds a new tool to this application.
tool | The new tool. |
void ModdedApplication::applyModAction | ( | int | deployer, |
int | action, | ||
int | mod_id ) |
Applies the given mod action to the given mod.
deployer | Target deployer. |
action | Action to be applied. |
mod_id | Target mod. |
void ModdedApplication::changeActiveGroupMember | ( | int | group, |
int | mod_id, | ||
std::optional< ProgressNode * > | progress_node = {} ) |
Changes the active member of given group to given mod.
group | Target group. |
mod_id | The new active member. |
progress_node | Used to inform about the current progress. |
void ModdedApplication::changeAutoTagEvaluator | ( | const std::string & | tag_name, |
const std::string & | expression, | ||
const std::vector< TagCondition > & | conditions, | ||
bool | update ) |
Changes the given tags evaluator according to the given expression and conditions.
tag_name | Target auto tag. |
expression | New expression to be used. |
conditions | Conditions for the new expression. |
update | If true: Update the auto tag map. |
void ModdedApplication::changeLoadorder | ( | int | deployer, |
int | from_index, | ||
int | to_index ) |
void ModdedApplication::changeManualTagName | ( | const std::string & | old_name, |
const std::string & | new_name, | ||
bool | update_map = true ) |
Changes the name of the given tag to the given new name. Fails if a tag by the given name exists.
old_name | Name of the target tag. |
new_name | Target tags new name. |
update_map | If true: Update the manual tag map. |
std::runtime_error | If a tag with the given new_name exists. |
void ModdedApplication::changeModName | ( | int | mod_id, |
const std::string & | new_name ) |
Changes the name of an installed mod.
mod_id | Id of the target mod. |
new_name | The new name. |
void ModdedApplication::changeModVersion | ( | int | mod_id, |
const std::string & | new_version ) |
Sets the given mod's version to the given new version.
mod_id | Target mod. |
new_version | The new version. |
void ModdedApplication::checkModsForUpdates | ( | const std::vector< int > & | mod_ids | ) |
Checks for updates for mods with the given ids.
mod_ids | Ids of the mods for which to check for updates. |
const std::string & ModdedApplication::command | ( | ) | const |
Getter for the command used to run this application.
void ModdedApplication::createGroup | ( | int | first_mod_id, |
int | second_mod_id, | ||
std::optional< ProgressNode * > | progress_node = {} ) |
Creates a new group containing the two given mods. A group is a set of mods where only one member, the active member, will be deployed.
first_mod_id | First mod. This will be the active member of the new group. |
second_mod_id | Second mod. |
progress_node | Used to inform about the current progress. |
void ModdedApplication::deployModsFor | ( | std::vector< int > | deployers | ) |
std::string ModdedApplication::downloadMod | ( | const std::string & | url, |
std::function< void(float)> | progress_callback ) |
Downloads the file from the given url to staging_dir_ / _download.
url | Url from which to download the file. |
void ModdedApplication::editAutoTags | ( | const std::vector< EditAutoTagAction > & | actions | ) |
Performs the given editing actions on the auto tags.
actions | Editing actions. |
void ModdedApplication::editDeployer | ( | int | deployer, |
const EditDeployerInfo & | info ) |
Used to set type, name and target directory for one deployer.
deployer | Target Deployer. |
info | Contains all data needed to edit a deployer, e.g. its new name. |
void ModdedApplication::editManualTags | ( | const std::vector< EditManualTagAction > & | actions | ) |
Performs the given editing actions on the manual tags.
actions | Editing actions. |
void ModdedApplication::editProfile | ( | int | profile, |
const EditProfileInfo & | info ) |
Used to set the name of a profile.
profile | Target Profile |
info | Contains the new profile data. |
void ModdedApplication::editTool | ( | int | tool_id, |
const Tool & | new_tool ) |
Used to replace an existing tool with a new tool.
tool_id | Target tool to be replaced. |
new_tool | The new tool. |
void ModdedApplication::exportConfiguration | ( | const std::vector< int > & | deployers, |
const std::vector< std::string > & | auto_tags ) |
Exports configurations for the given deployers and the given auto tags to a json file. Does not include mods.
deployers | Deployers to export. |
auto_tags | Auto tags to export. |
void ModdedApplication::extractArchive | ( | const std::filesystem::path & | source, |
const std::filesystem::path & | target ) |
Extracts the given archive to the given location.
source | Source path. |
target | Extraction target path. |
|
private |
Checks if the given path belongs to a steam installation or prefix directory. Replaces installation or prefix path components with tokens.
path | Path to check. |
AppInfo ModdedApplication::getAppInfo | ( | ) | const |
std::vector< BackupTarget > ModdedApplication::getBackupTargets | ( | ) | const |
Returns a vector containing information about all managed backup targets.
const std::string & ModdedApplication::getConfigFileName | ( | ) | const |
Getter for the name of the file used to store this objects internal state.
std::vector< std::vector< int > > ModdedApplication::getConflictGroups | ( | int | deployer | ) |
Returns the conflicts groups for the current profile of given deployer.
deployer | Target Deployer. |
DeployerInfo ModdedApplication::getDeployerInfo | ( | int | deployer | ) |
Creates DeployerInfo for one Deployer.
deployer | Target deployer. |
std::vector< std::string > ModdedApplication::getDeployerNames | ( | ) | const |
Creates a vector containing the names of all Deployer objects.
std::string ModdedApplication::getDownloadUrl | ( | const std::string & | nxm_url | ) |
Generates a download URL from the given NexusMods nxm Url.
nxm_url | The nxm URL used. |
std::string ModdedApplication::getDownloadUrlForFile | ( | int | nexus_file_id, |
const std::string & | mod_url ) |
Generates a download URL from the given NexusMods mod id and file id.
nexus_file_id | File id of the mod. |
mod_url | Url to the mod page on NexusMods. |
ExternalChangesInfo ModdedApplication::getExternalChanges | ( | int | deployer | ) |
Checks if files deployed by the given deployer have been externally overwritten.
deployer | Deployer to check. |
std::vector< ConflictInfo > ModdedApplication::getFileConflicts | ( | int | deployer, |
int | mod_id, | ||
bool | show_disabled ) const |
std::vector< std::tuple< int, bool > > ModdedApplication::getLoadorder | ( | int | deployer | ) | const |
std::unordered_set< int > ModdedApplication::getModConflicts | ( | int | deployer, |
int | mod_id ) |
int ModdedApplication::getModGroup | ( | int | mod_id | ) |
Returns the group to which the given mod belongs.
mod_id | Target mod. |
std::vector< ModInfo > ModdedApplication::getModInfo | ( | ) | const |
Creates a vector containing information about all installed mods, stored in ModInfo objects.
|
private |
Returns the name of a mod.
mod_id | The mod. |
Json::LogicError | Indicates a logic error, e.g. trying to convert "123" to a bool, while parsing. |
Json::RuntimeError | Indicates a syntax error in the JSON file. |
ParseError | Indicates a semantic error while parsing the JSON file, e.g. the active member of a group is not part of that group. |
nexus::Page ModdedApplication::getNexusPage | ( | int | mod_id | ) |
Fetches data from NexusMods for the given mod.
mod_id | Target mod id. |
std::string ModdedApplication::getNexusPageUrl | ( | const std::string & | nxm_url | ) |
Generates a NexusMods mod page URL from the given nxm URL.
nxm_url | The nxm Url used. This is usually generated through the NexusMods website. |
int ModdedApplication::getNumDeployers | ( | ) | const |
Returns the number of Deployer objects for this application.
int ModdedApplication::getNumGroups | ( | ) |
Returns the number of groups.
std::vector< std::string > ModdedApplication::getProfileNames | ( | ) | const |
Returns a vector containing the names of all profiles.
const sfs::path & ModdedApplication::getStagingDir | ( | ) | const |
Getter for the path to the staging directory. This is where all installed mods are stored.
std::vector< Tool > ModdedApplication::getTools | ( | ) | const |
Getter for the tools of this application.
void ModdedApplication::installMod | ( | const AddModInfo & | info | ) |
Installs a new mod using the given Installer type.
info | Contains all data needed to install the mod. |
void ModdedApplication::keepOrRevertFileModifications | ( | int | deployer, |
const FileChangeChoices & | changes_to_keep ) const |
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.
deployer | Target deployer. |
changes_to_keep | Contains 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. |
bool ModdedApplication::modHasGroup | ( | int | mod_id | ) |
Checks if given mod belongs to any group.
mod_id | Target mod. |
const std::string & ModdedApplication::name | ( | ) | const |
Getter for the name of this application.
void ModdedApplication::overwriteBackup | ( | int | target_id, |
int | source_backup, | ||
int | dest_backup ) |
Deletes all files in the dest backup and replaces them with the files from the source backup.
target_id | Backup target. |
source_backup | Backup from which to copy files. |
dest_backup | Target for data deletion. |
|
private |
Checks for available updates for mods with the given index in installed_mods_.
target_mod_indices | Target mod indices. |
void ModdedApplication::removeAutoTag | ( | const std::string & | tag_name, |
bool | update ) |
Removes the given auto tag.
name | Tag to be removed. |
update | If true: Update the auto tag map and the settings. |
void ModdedApplication::removeBackup | ( | int | target_id, |
int | backup_id ) |
Deletes the given backup for given target.
target_id | Target from which to delete a backup. |
backup_id | Backup to remove. |
void ModdedApplication::removeBackupTarget | ( | int | target_id | ) |
Removes the given backup target by deleting all backups, except for the active one, and all config files.
target_id | Target to remove. |
void ModdedApplication::removeDeployer | ( | int | deployer, |
bool | cleanup ) |
void ModdedApplication::removeManualTag | ( | const std::string & | tag_name, |
bool | update_map = true ) |
Removes the tag with the given name, if it exists.
tag_name | Tag to be removed. |
update_map | If true: Update the manual tag map. |
void ModdedApplication::removeModFromDeployer | ( | int | deployer, |
int | mod_id, | ||
bool | update_conflicts = true, | ||
std::optional< ProgressNode * > | progress_node = {} ) |
void ModdedApplication::removeModFromGroup | ( | int | mod_id, |
bool | update_conflicts = true, | ||
std::optional< ProgressNode * > | progress_node = {} ) |
Removes a mod from it's group.
mod_id | Target mod. |
update_conflicts | If true: Update relevant conflict groups. |
progress_node | Used to inform about the current progress. |
void ModdedApplication::removeProfile | ( | int | profile | ) |
Removes a profile.
profile | The profile to be removed. |
void ModdedApplication::removeTagsFromMods | ( | const std::vector< std::string > & | tag_names, |
const std::vector< int > & | mod_ids ) |
Removes the given tags from the given mods.
tag_name | Target tags name. |
mod_ids | Target mod ids. |
void ModdedApplication::removeTool | ( | int | tool_id | ) |
Removes a tool.
tool_id | The tool's id. |
void ModdedApplication::renameAutoTag | ( | const std::string & | old_name, |
const std::string & | new_name, | ||
bool | update ) |
Changes the name of the given auto tag to the given new name. Fails if a tag by the given name exists.
old_name | Name of the target tag. |
new_name | Target tags new name. |
update | If true: Update the auto tag map. |
std::runtime_error | If a tag with the given new_name exists. |
|
private |
Replaces an existing mod with the mod specified by the given argument.
info | Contains all data needed to install the mod. |
void ModdedApplication::setActiveBackup | ( | int | target_id, |
int | backup_id ) |
Changes the currently active backup for the given target.
target_id | Target for which to change the active backup. |
backup_id | New active backup. |
void ModdedApplication::setAppVersion | ( | const std::string & | app_version | ) |
Sets the app version of the currently active profile to the given version.
app_version | The new app version. |
void ModdedApplication::setBackupName | ( | int | target_id, |
int | backup_id, | ||
const std::string & | name ) |
Changes the name of the given backup for the given target.
target_id | Backup target. |
backup_id | Backup to be edited. |
name | The new name. |
void ModdedApplication::setBackupTargetName | ( | int | target_id, |
const std::string & | name ) |
Changes the name of the given backup target.
target_id | Backup target. |
name | The new name. |
void ModdedApplication::setCommand | ( | const std::string & | newCommand | ) |
Setter for the command used to run this application.
newCommand | The new command. |
void ModdedApplication::setIconPath | ( | const std::filesystem::path & | icon_path | ) |
Setter for icon_path_.
icon_path | The new icon path |
void ModdedApplication::setModSources | ( | int | mod_id, |
const std::string & | local_source, | ||
const std::string & | remote_source ) |
Sets the given mods local and remote sources to the given paths.
mod_id | Target mod id. |
local_source | Path to a local archive or directory used for mod installation. |
remote_source | Remote URL from which the mod was downloaded. |
void ModdedApplication::setModStatus | ( | int | deployer, |
int | mod_id, | ||
bool | status ) |
void ModdedApplication::setName | ( | const std::string & | newName | ) |
Setter for the name of this application.
newName | The new name. |
void ModdedApplication::setProfile | ( | int | profile | ) |
Sets the currently active profile.
profile | The new profile. |
void ModdedApplication::setProgressCallback | ( | const std::function< void(float)> & | progress_callback | ) |
Sets the callback function used to inform about the current task's progress.
progress_callback | The function. |
void ModdedApplication::setStagingDir | ( | std::string | staging_dir, |
bool | move_existing ) |
Setter for the path to the staging directory. This is where all installed mods are stored.
staging_dir | The new staging directory path. |
move_existing | If true: Move all installed mods to the new directory. |
Json::LogicError | Indicates a logic error, e.g. trying to convert "123" to a bool, while parsing. |
Json::RuntimeError | Indicates a syntax error in the JSON file. |
ParseError | Indicates a semantic error while parsing the JSON file, e.g. the active member of a group is not part of that group. |
void ModdedApplication::setTagsForMods | ( | const std::vector< std::string > & | tag_names, |
const std::vector< int > | mod_ids ) |
Sets the tags for all given mods to the given tags.
tag_names | Names of the new tags. |
mod_ids | Target mod ids. |
void ModdedApplication::sortModsByConflicts | ( | int | deployer | ) |
Sorts the load order by grouping mods which contain conflicting files.
deployer | Deployer for which the currently active load order is to be sorted. |
|
private |
void ModdedApplication::suppressUpdateNotification | ( | const std::vector< int > & | mod_ids | ) |
Temporarily disables update notifications for the given mods. This is done by setting the mods remote_update_time to the installation_time.
mod_ids | Ids of the mods for which update notifications are to be disabled. |
void ModdedApplication::unDeployModsFor | ( | std::vector< int > | deployers | ) |
Undeploys mods for the given deployers.
deployers | Target deployers. |
void ModdedApplication::uninstallGroupMembers | ( | const std::vector< int > & | mod_ids | ) |
Uninstalls all mods which are inactive group members of any group which contains any of the given mods.
mod_ids | Ids of the mods for which to uninstall group members. |
void ModdedApplication::uninstallMods | ( | const std::vector< int > & | mod_ids, |
const std::string & | installer_type = "" ) |
void ModdedApplication::updateAutoTags | ( | const std::vector< int > | mod_ids | ) |
Reapplies auto tags to the specified mods.
mod_ids | Mods to which auto tags are to be reapplied. |
|
private |
Updates the load order for every Deployer to reflect the current mod groups.
progress_node | Used to inform about the current progress. |
void ModdedApplication::updateIgnoredFiles | ( | int | deployer | ) |
Updates the file ignore list for ReverseDeployers.
deployer | Target deployer. |
void ModdedApplication::updateModDeployers | ( | const std::vector< int > & | mod_ids, |
const std::vector< bool > & | deployers ) |
Updates which deployer should manage given mods.
mod_id | Vector of mod ids to be added. |
deployers | Bool for every deployer, indicating if the mods should be managed by that deployer. |
|
private |
Updates json_settings_ with the current state of this object.
write | If true: write json_settings_ to a file after updating. |
|
private |
Updates the internal state of this object to the state stored in json_settings_.
read | If true: Read json_settings_ from a file before updating. |
std::tuple< int, std::string, std::string > ModdedApplication::verifyDeployerDirectories | ( | ) |
Checks if files can be deployed.
|
static |
Verifies if reading/ writing to the staging directory is possible and if the JSON file containing information about installed mods can be parsed.
staging_dir | Path to the staging directory. |
|
private |
For every profile: The version of the app managed by that profile.
This does not refer to a ModdedApplication object but rather the actually modded application.
|
private |
Callback for logging.