Archmage.FS
The file system from which the loader reads atlas.json, the config files and the override files.
Inherits: RefCounted
Extend this class to read files from elsewhere, such as from memory. Archmage.FileAccessFS is the default. file_exists() and dir_exists() return true unless overridden; keep that default when checking is not possible or is expensive.
Archmage.AtlasLoader.load_atlas_async() calls read_file() and file_exists() on worker threads, several at a time, so an implementation must be safe to call that way. Protect any state that the calls share, such as one ZIPReader used for all reads, with a Mutex. dir_exists() runs on the thread that starts the load.
Methods
Section titled “Methods”read_file()
Section titled “read_file()”@abstract func read_file(path: String) -> VariantReturns the content of the file at path as a PackedByteArray, or an Error code when the file cannot be read. Return ERR_FILE_NOT_FOUND when the file does not exist. When file_exists() returned true for an override file, the loader skips the file only on this code; any other code fails the load.
file_exists()
Section titled “file_exists()”func file_exists(_path: String) -> boolReturns whether the file at path exists. The loader calls it for each possible override file and reads only the files that exist.
dir_exists()
Section titled “dir_exists()”func dir_exists(_path: String) -> boolReturns whether the directory at path exists. The loader calls it for each override root and fails when it returns false.