Holds data and functions needed to pass a fomod file.
More...
#include <fomodinstaller.h>
|
| FomodInstaller ()=default |
| Default constructor.
|
|
void | init (const std::filesystem::path &config_file, const std::filesystem::path &target_path="", const std::string &app_version="") |
| Initializes the installer.
|
|
std::optional< InstallStep > | step (const std::vector< std::vector< bool > > &selection={}) |
| Advances installation process by one step.
|
|
std::optional< std::pair< std::vector< std::vector< bool > >, InstallStep > > | stepBack () |
| Returns a pair of the previous installation step and the selections made at that step.
|
|
bool | hasNextStep (const std::vector< std::vector< bool > > &selection) const |
| Checks if there is at least one more valid installation step.
|
|
std::vector< std::pair< std::filesystem::path, std::filesystem::path > > | getInstallationFiles (const std::vector< std::vector< bool > > &selection={}) |
| Returns all files to be installed with current selection.
|
|
bool | hasPreviousStep () const |
| Checks if there is a previous installation step.
|
|
bool | hasNoSteps () const |
| Checks if installation has not steps.
|
|
|
static std::pair< std::string, std::string > | getMetaData (const std::filesystem::path &path) |
| Extracts mod name and version from a fomod info file in path/fomod/info.xml.
|
|
|
void | parseFileList (const pugi::xml_node &file_list, std::vector< File > &target_vector, bool warn_missing=true) |
| Extracts all files from given file list node and appends them to given vector.
|
|
void | parseInstallSteps (const pugi::xml_node &steps) |
| Extracts all install steps from given node and stores them in steps_.
|
|
PluginGroup::Type | parseGroupType (const std::string &type) |
| Determines group type from given string.
|
|
void | parseInstallList () |
| Updates files_ according to the fomod files conditionalFileInstalls node.
|
|
void | initPlugin (const pugi::xml_node &xml_node, Plugin &plugin) |
| Initializes given plugin plugin from fomod node.
|
|
PluginType | parsePluginType (const std::string &type) |
| Determines plugin type from given string.
|
|
void | updateState (const std::vector< std::vector< bool > > &selection) |
| Updates flags_ and files_ with selection.
|
|
template<typename T> |
void | sortVector (std::vector< T > &source, std::string order) |
| Sorts given vector according to given ordering type.
|
|
|
static std::pair< std::string, std::string > | getFomodPath (const std::filesystem::path &source, const std::string &file_name="ModuleConfig.xml") |
| Tries to find fomod/file_name in the given path.
|
|
|
pugi::xml_document | config_file_ |
| Source fomod config file.
|
|
pugi::xml_node | config_ |
| Root node of the config file.
|
|
std::filesystem::path | target_path_ |
| Path used to check for file dependencies.
|
|
std::vector< File > | files_ |
| Contains all files extracted from the config file.
|
|
std::vector< InstallStep > | steps_ |
| Steps performed during installation.
|
|
int | cur_step_ = -1 |
| Current installation step.
|
|
std::map< std::string, std::string > | flags_ |
| Maps flags to their value.
|
|
std::filesystem::path | mod_base_path_ |
| Base path of the mod to be installed.
|
|
std::vector< std::vector< std::vector< bool > > > | prev_selections_ |
| Previous selections made during installation process.
|
|
std::function< bool(std::string)> | version_eval_fun_ = [](auto s) { return true; } |
| Used to evaluate game version conditions.
|
|
std::function< bool(std::string)> | fomm_eval_fun_ = [](auto s) { return true; } |
| Used to evaluate fomm version conditions.
|
|
Holds data and functions needed to pass a fomod file.
◆ getFomodPath()
std::pair< std::string, std::string > FomodInstaller::getFomodPath |
( |
const std::filesystem::path & | source, |
|
|
const std::string & | file_name = "ModuleConfig.xml" ) |
|
staticprivate |
Tries to find fomod/file_name in the given path.
- Parameters
-
source | Path to check. |
file_name | File name to search for. |
- Returns
- Name of fomod directory and file, adapted to the actual capitalization.
◆ getInstallationFiles()
std::vector< std::pair< sfs::path, sfs::path > > FomodInstaller::getInstallationFiles |
( |
const std::vector< std::vector< bool > > & | selection = {} | ) |
|
Returns all files to be installed with current selection.
- Parameters
-
selection | For every group: for every plugin: True if selected. |
- Returns
- Pair or source, destination paths for every file.
◆ getMetaData()
std::pair< std::string, std::string > FomodInstaller::getMetaData |
( |
const std::filesystem::path & | path | ) |
|
|
static |
Extracts mod name and version from a fomod info file in path/fomod/info.xml.
- Parameters
-
- Returns
- Mod name and version.
◆ hasNextStep()
bool FomodInstaller::hasNextStep |
( |
const std::vector< std::vector< bool > > & | selection | ) |
const |
Checks if there is at least one more valid installation step.
- Parameters
-
selection | Current plugin selection. |
- Returns
- True if more steps exist.
◆ hasNoSteps()
bool FomodInstaller::hasNoSteps |
( |
| ) |
const |
Checks if installation has not steps.
- Returns
- True if no steps where found.
◆ hasPreviousStep()
bool FomodInstaller::hasPreviousStep |
( |
| ) |
const |
Checks if there is a previous installation step.
- Returns
- True if there is one.
◆ init()
void FomodInstaller::init |
( |
const std::filesystem::path & | config_file, |
|
|
const std::filesystem::path & | target_path = "", |
|
|
const std::string & | app_version = "" ) |
Initializes the installer.
- Parameters
-
config_file | Fomod file to be parsed. |
target_path | Installation target, this is only used to check file dependencies. |
◆ initPlugin()
void FomodInstaller::initPlugin |
( |
const pugi::xml_node & | xml_node, |
|
|
Plugin & | plugin ) |
|
private |
Initializes given plugin plugin from fomod node.
- Parameters
-
xml_node | Source node. |
plugin | Target plugin. |
◆ parseFileList()
void FomodInstaller::parseFileList |
( |
const pugi::xml_node & | file_list, |
|
|
std::vector< File > & | target_vector, |
|
|
bool | warn_missing = true ) |
|
private |
Extracts all files from given file list node and appends them to given vector.
- Parameters
-
file_list | Source file list. |
target_list | Extracted files will be appended to this vector. |
warn_missing | If true: Warn if a file is missing. |
◆ parseGroupType()
Determines group type from given string.
- Parameters
-
- Returns
- The type.
◆ parseInstallSteps()
void FomodInstaller::parseInstallSteps |
( |
const pugi::xml_node & | steps | ) |
|
|
private |
Extracts all install steps from given node and stores them in steps_.
- Parameters
-
◆ parsePluginType()
PluginType FomodInstaller::parsePluginType |
( |
const std::string & | type | ) |
|
|
private |
Determines plugin type from given string.
- Parameters
-
- Returns
- The type.
◆ sortVector()
template<typename T>
void fomod::FomodInstaller::sortVector |
( |
std::vector< T > & | source, |
|
|
std::string | order ) |
|
inlineprivate |
Sorts given vector according to given ordering type.
- Parameters
-
source | Vector to be sorted. |
order | Ordering type. |
◆ step()
std::optional< InstallStep > FomodInstaller::step |
( |
const std::vector< std::vector< bool > > & | selection = {} | ) |
|
Advances installation process by one step.
- Parameters
-
selection | For every group: for every plugin: True if selected. |
- Returns
- The next installation step, if one exists.
◆ stepBack()
std::optional< std::pair< std::vector< std::vector< bool > >, InstallStep > > FomodInstaller::stepBack |
( |
| ) |
|
Returns a pair of the previous installation step and the selections made at that step.
- Returns
- The step, if one exists.
◆ updateState()
void FomodInstaller::updateState |
( |
const std::vector< std::vector< bool > > & | selection | ) |
|
|
private |
Updates flags_ and files_ with selection.
- Parameters
-
selection | For every group: for every plugin: True if selected. |
The documentation for this class was generated from the following files: