A standard interface for the various file systems that Polymod supports.

Methods

exists(path:String):Bool

Returns whether the file or directory at the given path exists.

Parameters:

path

The path to check.

Returns:

Whether there is a file or directory there.

getFileBytes(path:String):Null<Bytes>

Returns the content of a given file as Bytes. Returns null if the file can't be found.

Parameters:

path

The file to read.

Returns:

The byte content of the file.

getFileContent(path:String):Null<String>

Returns the content of a given file as a string. Returns null if the file can't be found.

Parameters:

path

The file to read.

Returns:

The text content of the file.

getMetadata(modId:String):Null<ModMetadata>

Provides the metadata for a given mod. Returns null if the mod does not exist.

Parameters:

modId

The ID of the mod.

Returns:

The mod metadata.

isDirectory(path:String):Bool

Returns whether the provided path is a directory.

Parameters:

path

The path to check.

Returns:

Whether the path is a directory.

readDirectory(path:String):Array<String>

Returns a list of files and folders contained within the provided directory path. Does not return files in subfolders, use readDirectoryRecursive for that.

Parameters:

path

The path to check.

Returns:

An array of file paths and folder paths.

readDirectoryRecursive(path:String):Array<String>

Returns a list of files contained within the provided directory path. Checks all subfolders recursively. Returns only files.

Parameters:

path

The path to check.

Returns:

An array of file paths.

scanMods(?apiVersionRule:VersionRule):Array<ModMetadata>

Provide a list of valid mods for this file system to load.

Parameters:

apiVersionRule

(optional) A version query to match against the mod's API version.

Returns:

An array of matching mods.