ModDataChecker

class mobase.ModDataChecker

Bases: ABC

Game feature that is used to check the content of a data tree.

Attributes Summary

FIXABLE

INVALID

VALID

Methods Summary

dataLooksValid(filetree)

Check that the given filetree represent a valid mod layout, or can be easily fixed.

fix(filetree)

Try to fix the given tree.

Attributes Documentation

FIXABLE: CheckReturn = Ellipsis
INVALID: CheckReturn = Ellipsis
VALID: CheckReturn = Ellipsis

Methods Documentation

abstract dataLooksValid(filetree)

Check that the given filetree represent a valid mod layout, or can be easily fixed.

This method is mainly used during installation (to find which installer should be used or to recurse into multi-level archives), or to quickly indicates to a user if a mod looks valid.

This method does not have to be exact, it only has to indicate if the given tree looks like a valid mod or not by quickly checking the structure (heavy operations should be avoided).

If the tree can be fixed by the fix() method, this method should return FIXABLE. FIXABLE should only be returned when it is guaranteed that fix() can fix the tree.

Return type:

CheckReturn

Parameters:

filetree – The tree starting at the root of the “data” folder.

Returns:

Whether the tree is invalid, fixable or valid.

fix(filetree)

Try to fix the given tree.

This method is used during installation to try to fix invalid archives and will only be called if dataLooksValid returned FIXABLE.

Return type:

Optional[IFileTree]

Parameters:

filetree – The tree to try to fix. Can be modified during the process.

Returns:

The fixed tree, or a null pointer if the tree could not be fixed.