source-fs
A straightforward library for building and querying Source Engine virtual filesystems.
It automatically parses gameinfo.txt, correctly resolves Valve's SearchPaths priorities, handles macro expansions (like |all_source_engine_paths|), and provides case-insensitive file resolution for Unix-like systems.
Inspired by craftablescience/sourcepp.
Example
Add this to your Cargo.toml:
[]
= "0.1.0"
Loading the FileSystem and reading a file
use create_fs;
Using Steam auto-discovery (requires steam feature)
[]
= { = "0.1.0", = ["steam"] }
use ;
API
source_fs::create_fs- Initialize the filesystem from a local physical directory.source_fs::FileSystem- The core struct managing search paths and mounted archives..load_from_path::<G>()- Load customGameInfoProvider..read()- Read a file as raw bytes (Vec<u8>)..read_str()- Read a file as a UTF-8 String.find_file()- Find a file in the virtual filesystem.
source_fs::traits::PackFile- Abstract trait to implement your own VPK parser.source_fs::traits::GameInfoProvider- Abstract trait to parse custom game configurations (e.g. Portal 2 DLC system).
License
MIT License.