Skip to content

system

FreeBodyEngine.core.files.system #

FileSystem() #

Bases: Service

Base class for the engine's pluggable file backends (DevFileSystem for loose files on disk, AssetPackFileSystem for bundled release .paks) - registered as the "files" service, so callers go through get_service('files') rather than depending on a concrete subclass.

Registers this instance as the "files" service and sets up the empty resource registry subclasses' get_file() implementations add to via _add().

current_file_id = 0 instance-attribute #

resources = {} instance-attribute #

ensure_path(path) #

Returns whether path exists in this backend.

ensure_trailing_slash(path) #

Ensures a directory path ends with a forward slash. Assumes the path has already been sanitised

generate_file_id() #

Returns a fresh, unique id for a new FileResource - ids are assigned sequentially and never reused within this FileSystem's lifetime.

get_file(path) #

Resolves path (a virtual asset path, e.g. possibly prefixed with user:// or engine://) to a FileResource, or None if it can't be resolved.

sanitise_path(path) #

Converts file paths to use the forward slash standard.