This article is about de::FS, the virtual file system of Doomsday 2.
Internal file system
The de::FS class is the main interface to the libdeng2 internal file system. It maintains a tree of files and folders. It provides a way to quickly and efficiently locate files anywhere in the tree. It also contains semantic information about the structure and content of the tree, allowing others to know how to treat the files and folders.
de::FS plays a very central role in libdeng2. It is not simply a mapping of the native file system contents to a portable, logical folder hierarchy: it also provides access to most of the engine's internal state, including configuration scripts, UI objects, the game world and its objects, and other runtime data.
All access to the native file system occurs via de::FS. The folder /home maps to the user's runtime folder and has write access. Many other folders in the file system do not have write access, e.g., /bin and /data.
de::FS is significantly influenced by the Unix file system model:
- Slashes (/) are used as folder separators in paths so they are not allowed in file/folder names.
- "/" is the root folder.
- ".." is the parent folder of the current folder.
In practice, the file system consists of a tree of various de::File and de::Folder instances. These instances are generated by the Feed objects attached to the folders. For instance, a DirectoryFeed will generate the appropriate File and Folder instances for a directory in the native file system.
The file system can be repopulated at any time to resynchronize it with the source data. Repopulation is nondestructive as long as the source data has not changed. Repopulation is needed for instance when native files get deleted in the directory a folder is feeding on. The feeds are responsible for deciding when instances get out-of-date and need to be deleted (pruning). Pruning occurs when a folder that is already populated with files is repopulated.
- Internal file system proposal