![]() |
Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|


Public Member Functions | |
| VFS () | |
| Status | Mount (const VfsPath &mountPoint, const OsPath &path, size_t flags, size_t priority) final |
| mount a directory into the VFS. More... | |
| Status | GetFileInfo (const VfsPath &pathname, CFileInfo *pfileInfo) const final |
| Retrieve information about a file (similar to POSIX stat). More... | |
| Status | GetFilePriority (const VfsPath &pathname, size_t *ppriority) const final |
| Retrieve mount priority for a file. More... | |
| Status | GetDirectoryEntries (const VfsPath &path, CFileInfos *fileInfos, DirectoryNames *subdirectoryNames) const final |
| Retrieve lists of all files and subdirectories in a directory. More... | |
| Status | CreateFile (const VfsPath &pathname, std::span< const std::uint8_t > fileContents) final |
| Create a file with the given contents. More... | |
| Status | LoadFile (const VfsPath &pathname, std::shared_ptr< std::uint8_t > &fileContents, size_t &size) final |
| Read an entire file into memory. More... | |
| Status | LoadFile (const VfsPath &pathname, std::unique_ptr< std::uint8_t[], AlignedDeleter > &fileContents, size_t &size) final |
| Read an entire file into memory. More... | |
| std::wstring | TextRepresentation () const final |
| Status | GetOriginalPath (const VfsPath &pathname, OsPath &realPathname) final |
| Retrieve the POSIX pathname a VFS file was loaded from. More... | |
| Status | GetRealPath (const VfsPath &pathname, OsPath &realPathname, bool createMissingDirectories) final |
| Retrieve the real (POSIX) pathname underlying a VFS file. More... | |
| Status | GetDirectoryRealPath (const VfsPath &pathname, OsPath &realPathname, bool createMissingDirectories) final |
| Retrieve the real (POSIX) pathname underlying a VFS directory. More... | |
| Status | GetVirtualPath (const OsPath &realPathname, VfsPath &pathname) final |
| retrieve the VFS pathname that corresponds to a real file. More... | |
| Status | RemoveFile (const VfsPath &pathname) final |
| remove file from the virtual directory listing. More... | |
| Status | RepopulateDirectory (const VfsPath &path) final |
| request the directory be re-populated when it is next accessed. More... | |
| void | Clear () final |
| empty the contents of the filesystem. More... | |
Public Member Functions inherited from IVFS | |
| virtual | ~IVFS () |
| virtual Status | Mount (const VfsPath &mountPoint, const OsPath &path, size_t flags=0, size_t priority=0)=0 |
| mount a directory into the VFS. More... | |
| virtual Status | GetFileInfo (const VfsPath &pathname, CFileInfo *pfileInfo) const =0 |
| Retrieve information about a file (similar to POSIX stat). More... | |
| virtual Status | GetFilePriority (const VfsPath &pathname, size_t *ppriority) const =0 |
| Retrieve mount priority for a file. More... | |
| virtual Status | GetDirectoryEntries (const VfsPath &path, CFileInfos *fileInfos, DirectoryNames *subdirectoryNames) const =0 |
| Retrieve lists of all files and subdirectories in a directory. More... | |
| virtual Status | CreateFile (const VfsPath &pathname, std::span< const std::uint8_t > fileContents)=0 |
| Create a file with the given contents. More... | |
| virtual Status | LoadFile (const VfsPath &pathname, std::shared_ptr< std::uint8_t > &fileContents, size_t &size)=0 |
| Read an entire file into memory. More... | |
| virtual Status | LoadFile (const VfsPath &pathname, std::unique_ptr< std::uint8_t[], AlignedDeleter > &fileContents, size_t &size)=0 |
| Read an entire file into memory. More... | |
| virtual std::wstring | TextRepresentation () const =0 |
| virtual Status | GetOriginalPath (const VfsPath &filename, OsPath &loadedPathname)=0 |
| Retrieve the POSIX pathname a VFS file was loaded from. More... | |
| virtual Status | GetRealPath (const VfsPath &pathname, OsPath &realPathname, bool createMissingDirectories=true)=0 |
| Retrieve the real (POSIX) pathname underlying a VFS file. More... | |
| virtual Status | GetDirectoryRealPath (const VfsPath &pathname, OsPath &realPathname, bool createMissingDirectories=true)=0 |
| Retrieve the real (POSIX) pathname underlying a VFS directory. More... | |
| virtual Status | GetVirtualPath (const OsPath &realPathname, VfsPath &pathname)=0 |
| retrieve the VFS pathname that corresponds to a real file. More... | |
| virtual Status | RemoveFile (const VfsPath &pathname)=0 |
| remove file from the virtual directory listing. More... | |
| virtual Status | RepopulateDirectory (const VfsPath &path)=0 |
| request the directory be re-populated when it is next accessed. More... | |
| virtual void | Clear ()=0 |
| empty the contents of the filesystem. More... | |
Private Member Functions | |
| Status | FindRealPathR (const OsPath &realPath, const VfsDirectory &directory, const VfsPath &curPath, VfsPath &path) |
Private Attributes | |
| PITrace | m_trace |
| VfsDirectory | m_rootDirectory |
|
inline |
|
inlinefinalvirtual |
empty the contents of the filesystem.
this is typically only necessary when changing the set of mounted directories, e.g. when switching mods. NB: open files are not affected.
Implements IVFS.
|
inlinefinalvirtual |
Create a file with the given contents.
| pathname | |
| fileContents | the pointer must be aligned to maxSectorSize |
Implements IVFS.
|
inlineprivate |
|
inlinefinalvirtual |
Retrieve lists of all files and subdirectories in a directory.
Rationale:
Implements IVFS.
|
inlinefinalvirtual |
Retrieve the real (POSIX) pathname underlying a VFS directory.
This is useful for passing paths to external libraries. Note that this returns the real path relative to the highest priority VFS subpath.
| createMissingDirectories | - if true, create subdirectories on the file system as required. (this defaults to true because, in general, this function is then used to create new files). |
Implements IVFS.
|
inlinefinalvirtual |
Retrieve information about a file (similar to POSIX stat).
| pathname | |
| pfileInfo | receives information about the file. Passing NULL suppresses warnings if the file doesn't exist. |
Implements IVFS.
|
inlinefinalvirtual |
Retrieve mount priority for a file.
| pathname | |
| ppriority | receives priority value, if the file can be found. |
Implements IVFS.
|
inlinefinalvirtual |
Retrieve the POSIX pathname a VFS file was loaded from.
This is distinct from the current 'real' path, since that depends on the parent directory's real path, which may have been overwritten by a mod or another call to Mount().
This is used by the caching to split by mod, and you also ought to call this to delete a file. (note that deleting has other issues, see below).
Implements IVFS.
|
inlinefinalvirtual |
Retrieve the real (POSIX) pathname underlying a VFS file.
This is useful for passing paths to external libraries. Note that this returns the real path relative to the highest priority VFS subpath.
| createMissingDirectories | - if true, create subdirectories on the file system as required. (this defaults to true because, in general, this function is then used to create new files). |
Implements IVFS.
retrieve the VFS pathname that corresponds to a real file.
this is useful for reacting to file change notifications.
the current implementation requires time proportional to the number of directories; this could be accelerated by only checking directories below a mount point with a matching real path.
Implements IVFS.
|
inlinefinalvirtual |
Read an entire file into memory.
| pathname | |
| fileContents | receives a smart pointer to the contents. |
| size | receives the size [bytes] of the file contents. |
Implements IVFS.
|
inlinefinalvirtual |
Read an entire file into memory.
| pathname | |
| fileContents | receives a unique pointer to the contents. |
| size | receives the size [bytes] of the file contents. |
Implements IVFS.
|
inlinefinalvirtual |
mount a directory into the VFS.
| mountPoint | (will be created if it does not already exist) |
| path | real directory path |
| flags | |
| priority |
if files are encountered that already exist in the VFS (sub)directories, the most recent / highest priority/precedence version is preferred.
Note that the 'real directory' associated with a VFS Path will be relative to the highest priority subdirectory in the path, and that in case of equal priority, the order is undefined, and will depend on the exact order of populate() calls.
if files with archive extensions are seen, their contents are added as well.
Implements IVFS.
remove file from the virtual directory listing.
Implements IVFS.
request the directory be re-populated when it is next accessed.
useful for synchronizing with the underlying filesystem after files have been created or their metadata changed.
Implements IVFS.
|
inlinefinalvirtual |
Implements IVFS.
|
mutableprivate |
|
private |