vfstool
vfstool is a command-line utility for interacting with OpenMW's virtual file system (VFS). It allows users to locate files, serialize the VFS to various formats, extract files, and even collapse the VFS into a single directory for space savings, and to reuse OpenMW's feature set for other games.
Features
- Collapse the VFS: Create a set of hardlinks or symbolic links for the entire VFS in a target directory.
- Extract Files: Extract specific files from the VFS to a given directory.
- Find Files: Locate files in the VFS by name, extension, or other criteria.
- Serialize the VFS: Output the VFS structure in JSON, YAML, or TOML formats.
- Filter Remaining Files: Identify files in a directory that are replaced or not replaced by the VFS.
Installation
Clone the repository and build the tool using cargo:
Usage
Global Options
-c, --config <CONFIG>: Path to the directory containingopenmw.cfg. If omitted, the system default location is used.-r, --use-relative: Use relative paths in output.-h, --help: Describe usage of the app or any subcommand
Commands
collapse
Collapse the VFS into a target directory using hardlinks, symbolic links, or file copies.
Options:
<COLLAPSE_INTO>: Target folder to collapse the VFS into.-a, --allow-copying: Fall back to copying files if linking fails.-e, --extract-archives: Extract files from BSA/BA2 archives during collapsing.-s, --symbolic: Use symbolic links instead of hardlinks.
extract
Extract a specific file from the VFS into a target directory.
Arguments:
<SOURCE_FILE>: Full relative path to a VFS file (e.g.,meshes/xbase_anim.nif).<TARGET_DIR>: Directory to extract the file to.
find-file
Locate a specific file in the VFS and return its absolute or relative path.
Arguments:
<PATH>: Full (relative) VFS path to query.
Options:
-s, --simple: Output the result in a simple format (no colors or formatting).
find
Search for files in the VFS based on a query term.
Options:
-p, --path <PATH>: Query term, actual contents depend on search type. Mandatory-f, --format <FORMAT>: Output format (json,yaml, ortoml). Default:yaml.-o, --output <OUTPUT>: Path to save the search results. If omitted, results are printed to stdout.-t, --type <TYPE>: Type of filter to use when searching. Default:name.
Filter Types:
exact: Match the exact VFS path.name: Match files containing the query in their name.name-exact: Match files with the exact name.folder: Match files in a specific folder.prefix: Match files with a specific prefix.extension: Match files with a specific extension.stem: Match files by their stem (filename without extension).stem-exact: Match files by their exact stem.
remaining
Filter the VFS to show files replacing or not replacing contents of a given directory.
Arguments:
<FILTER_PATH>: Absolute path to filter against.
Options:
-r, --replacements-only: Show only files replacing contents of the given path.-f, --format <FORMAT>: Output format (json,yaml, ortoml). Default:yaml.-o, --output <OUTPUT>: Path to save the filtered VFS. If omitted, results are printed to stdout.
Examples
Collapse the VFS into a directory with symlinks
This form is the most space-efficient variant of collapse, since it doesn't copy or extract files. It's fragile and most ideal for testing mods.
Collapse the VFS into a single directory, with extraction and hardlinks
This form consumes more space and takes longer due to extracting archive contents, but will perform better ingame and allow removing BSAs entirely.
Extract a file from the VFS
Find a file in the VFS
Search for files by extension
Show files replacing contents of a directory
License
This project is licensed under the MIT License. See the LICENSE file for details.