giant freakin documentation and reorganization pass, it also uses cmake because all the building was getting too complicated for shell scripts
This commit is contained in:
@@ -12,6 +12,8 @@ import fs.osfs
|
||||
|
||||
from . import core
|
||||
|
||||
## \brief Handler for virtual filesystem.
|
||||
# \internal
|
||||
class GameVFSHandler(object):
|
||||
vfs = None
|
||||
log = logging.getLogger().getChild("vfs")
|
||||
@@ -43,6 +45,10 @@ class GameVFSHandler(object):
|
||||
except:
|
||||
raise
|
||||
|
||||
## \brief Load files from a given data source.
|
||||
# \param source The data source. This can be a pyfilesystem2 object, or any string or path-like
|
||||
# object that can reasonably be interpreted as a directory or zip file.
|
||||
# \param proto The <a href="https://pyfilesystem2.readthedocs.io/en/latest/builtin.html">PyFilesystem2 filesystem protocol</a> to use. Defaults to `"osfs"`, which loads directories.
|
||||
def load_data_source(self, source: pathlib.Path | fs.base.FS | typing.Text, proto="osfs"):
|
||||
print(f"data source: {source} ({proto})")
|
||||
assert self.vfs is not None
|
||||
@@ -63,6 +69,10 @@ class GameVFSHandler(object):
|
||||
self.log.info(f"loading vfs source: {fs_source} (pyfilesystem2 handler)")
|
||||
fs.copy.copy_fs(fs_source, self.vfs)
|
||||
|
||||
## \brief Copies a file out of VFS into the real filesystem.
|
||||
# \param filepath The source file path to copy out.
|
||||
# \param dest The path to write the file to. Defaults to temporary directory.
|
||||
# \return The full destination file path.
|
||||
def copy_out(self, filepath, dest=None):
|
||||
if not dest:
|
||||
self.osfs_temp.makedirs(pathlib.Path(filepath).parent.as_posix(), recreate=True)
|
||||
@@ -76,4 +86,6 @@ class GameVFSHandler(object):
|
||||
fs.copy.copy_file(self.vfs, filepath, dest, filepath)
|
||||
return (pth_dest / filepath).as_posix()
|
||||
|
||||
## \brief Primary VFS handler.
|
||||
# \internal
|
||||
vfs = GameVFSHandler()
|
Reference in New Issue
Block a user