IInstallationManager

class mobase.IInstallationManager

Bases: object

Methods Summary

createFile(entry)

Create a new file on the disk corresponding to the given entry.

extractFile(entry[, silent])

Extract the specified file from the currently opened archive to a temporary location.

extractFiles(entries[, silent])

Extract the specified files from the currently opened archive to a temporary location.

getSupportedExtensions()

rtype:

Sequence[str]

installArchive(mod_name, archive[, mod_id])

Install the given archive.

Methods Documentation

createFile(entry)

Create a new file on the disk corresponding to the given entry.

This method can be used by installer that needs to create files that are not in the original archive. At the end of the installation, if there are entries in the final tree that were used to create files, the corresponding files will be moved to the mod folder.

Temporary files corresponding to created files are automatically cleaned up at the end of the installation.

Return type:

str

Parameters:

entry – The entry for which a temporary file should be created.

Returns:

The path to the created file, or an empty string if the file could not be created.

extractFile(entry, silent=False)

Extract the specified file from the currently opened archive to a temporary location.

This method cannot be used to extract directory.

The call will fail with an exception if no archive is open (plugins deriving from IPluginInstallerSimple can rely on that, custom installers should not). The temporary file is automatically cleaned up after the installation. This call can be very slow if the archive is large and “solid”.

Return type:

str

Parameters:
  • entry – Entry corresponding to the file to extract.

  • silent – If true, the dialog showing extraction progress will not be shown.

Returns:

The absolute path to the temporary file, or an empty string if the file was not extracted.

extractFiles(entries, silent=False)

Extract the specified files from the currently opened archive to a temporary location.

This method cannot be used to extract directories.

The call will fail with an exception if no archive is open (plugins deriving from IPluginInstallerSimple can rely on that, custom installers should not). The temporary files are automatically cleaned up after the installation. This call can be very slow if the archive is large and “solid”.

Return type:

Sequence[str]

Parameters:
  • entries – Entries corresponding to the files to extract.

  • silent – If true, the dialog showing extraction progress will not be shown.

Returns:

A list containing absolute paths to the temporary files.

getSupportedExtensions()
Return type:

Sequence[str]

Returns:

The extensions of archives supported by this installation manager.

installArchive(mod_name, archive, mod_id=0)

Install the given archive.

Return type:

Tuple[InstallResult, str, int]

Parameters:
  • mod_name – Suggested name of the mod.

  • archive – Path to the archive to install.

  • mod_id – ID of the mod, if available.

Returns:

The result of the installation.