Pyrogenesis  trunk
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CModInstaller Class Reference

Install a mod into the mods directory. More...

#include <ModInstaller.h>

Collaboration diagram for CModInstaller:
Collaboration graph
[legend]

Public Types

enum  ModInstallationResult {
  SUCCESS, FAIL_ON_VFS_MOUNT, FAIL_ON_MOD_LOAD, FAIL_ON_PARSE_JSON,
  FAIL_ON_EXTRACT_NAME, FAIL_ON_MOD_MOVE, FAIL_ON_JSON_WRITE, FAIL_ON_MOD_COPY
}
 

Public Member Functions

 CModInstaller (const OsPath &modsdir, const OsPath &tempdir)
 Initialise the mod installer for processing the given mod. More...
 
 ~CModInstaller ()
 
ModInstallationResult Install (const OsPath &mod, const std::shared_ptr< ScriptContext > &scriptContext, bool keepFile)
 Process and unpack the mod. More...
 
const std::vector< CStr > & GetInstalledMods () const
 

Static Public Member Functions

static bool IsDefaultModExtension (const Path &ext)
 

Private Attributes

PIVFS m_VFS
 
OsPath m_ModsDir
 
OsPath m_TempDir
 
VfsPath m_CacheDir
 
std::vector< CStr > m_InstalledMods
 

Detailed Description

Install a mod into the mods directory.

Member Enumeration Documentation

◆ ModInstallationResult

Enumerator
SUCCESS 
FAIL_ON_VFS_MOUNT 
FAIL_ON_MOD_LOAD 
FAIL_ON_PARSE_JSON 
FAIL_ON_EXTRACT_NAME 
FAIL_ON_MOD_MOVE 
FAIL_ON_JSON_WRITE 
FAIL_ON_MOD_COPY 

Constructor & Destructor Documentation

◆ CModInstaller()

CModInstaller::CModInstaller ( const OsPath modsdir,
const OsPath tempdir 
)

Initialise the mod installer for processing the given mod.

Parameters
modsdirpath to the data directory that contains mods
tempdirpath to a writable directory for temporary files

◆ ~CModInstaller()

CModInstaller::~CModInstaller ( )

Member Function Documentation

◆ GetInstalledMods()

const std::vector< CStr > & CModInstaller::GetInstalledMods ( ) const
Returns
a list of all mods installed so far by this CModInstaller.

◆ Install()

CModInstaller::ModInstallationResult CModInstaller::Install ( const OsPath mod,
const std::shared_ptr< ScriptContext > &  scriptContext,
bool  keepFile 
)

Process and unpack the mod.

Parameters
modpath of .pyromod/.zip file
keepFileif true, copy the file, if false move it

◆ IsDefaultModExtension()

static bool CModInstaller::IsDefaultModExtension ( const Path ext)
inlinestatic
Returns
whether the path has a mod-like extension.

Member Data Documentation

◆ m_CacheDir

VfsPath CModInstaller::m_CacheDir
private

◆ m_InstalledMods

std::vector<CStr> CModInstaller::m_InstalledMods
private

◆ m_ModsDir

OsPath CModInstaller::m_ModsDir
private

◆ m_TempDir

OsPath CModInstaller::m_TempDir
private

◆ m_VFS

PIVFS CModInstaller::m_VFS
private

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