pub struct FileSystem<P: PackFile> { /* private fields */ }Expand description
Core FileSystem representation holding physical directories and loaded pack files.
Implementations§
Source§impl<P: PackFile> FileSystem<P>
impl<P: PackFile> FileSystem<P>
Sourcepub fn load_from_path<G: GameInfoProvider>(
game_path: &Path,
options: &FileSystemOptions,
) -> Result<Self, FileSystemError>
pub fn load_from_path<G: GameInfoProvider>( game_path: &Path, options: &FileSystemOptions, ) -> Result<Self, FileSystemError>
Loads the filesystem from a specific game directory (where gameinfo.txt resides).
pub fn root_path(&self) -> &PathBuf
pub fn search_path_dirs(&self) -> &HashMap<String, Vec<PathBuf>>
pub fn search_path_dirs_mut(&mut self) -> &mut HashMap<String, Vec<PathBuf>>
pub fn search_path_vpks(&self) -> &HashMap<String, Vec<Arc<P>>>
pub fn search_path_vpks_mut(&mut self) -> &mut HashMap<String, Vec<Arc<P>>>
pub fn find_file(&self, file_path: &str, search_path: &str) -> Option<PathBuf>
Sourcepub fn read(
&self,
file_path: &str,
search_path: &str,
prioritize_vpks: bool,
) -> Option<Vec<u8>>
pub fn read( &self, file_path: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<Vec<u8>>
Reads data from the internal mounted paths using standard Source Engine priorities.
Sourcepub fn read_for_map(
&self,
map_pack: Option<&P>,
file_path: &str,
search_path: &str,
prioritize_vpks: bool,
) -> Option<Vec<u8>>
pub fn read_for_map( &self, map_pack: Option<&P>, file_path: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<Vec<u8>>
Same as read, but takes an optional active map pack file which gets highest priority.
pub fn read_str( &self, file_path: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<String>
Sourcepub fn find_asset(
&self,
name: &str,
prefix: &str,
suffix: &str,
search_path: &str,
) -> Option<PathBuf>
pub fn find_asset( &self, name: &str, prefix: &str, suffix: &str, search_path: &str, ) -> Option<PathBuf>
Finds an asset’s PathBuf without reading its contents into memory.
Sourcepub fn read_asset(
&self,
name: &str,
prefix: &str,
suffix: &str,
search_path: &str,
prioritize_vpks: bool,
) -> Option<Vec<u8>>
pub fn read_asset( &self, name: &str, prefix: &str, suffix: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<Vec<u8>>
Reads any asset as raw bytes, safely appending prefix and suffix if missing.
Sourcepub fn read_asset_str(
&self,
name: &str,
prefix: &str,
suffix: &str,
search_path: &str,
prioritize_vpks: bool,
) -> Option<String>
pub fn read_asset_str( &self, name: &str, prefix: &str, suffix: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<String>
Reads any asset as a UTF-8 string, safely appending prefix and suffix if missing.
Sourcepub fn read_material(
&self,
name: &str,
search_path: &str,
prioritize_vpks: bool,
) -> Option<Vec<u8>>
pub fn read_material( &self, name: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<Vec<u8>>
Reads a material file (.vmt).
Sourcepub fn read_material_str(
&self,
name: &str,
search_path: &str,
prioritize_vpks: bool,
) -> Option<String>
pub fn read_material_str( &self, name: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<String>
Reads a material file (.vmt) as a UTF-8 string.
Sourcepub fn read_model(
&self,
name: &str,
search_path: &str,
prioritize_vpks: bool,
) -> Option<Vec<u8>>
pub fn read_model( &self, name: &str, search_path: &str, prioritize_vpks: bool, ) -> Option<Vec<u8>>
Reads a model file (.mdl).
Trait Implementations§
Source§impl<P: PackFile> Clone for FileSystem<P>
impl<P: PackFile> Clone for FileSystem<P>
Auto Trait Implementations§
impl<P> Freeze for FileSystem<P>
impl<P> RefUnwindSafe for FileSystem<P>where
P: RefUnwindSafe,
impl<P> Send for FileSystem<P>
impl<P> Sync for FileSystem<P>
impl<P> Unpin for FileSystem<P>
impl<P> UnsafeUnpin for FileSystem<P>
impl<P> UnwindSafe for FileSystem<P>where
P: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more