pub struct FileSystem { /* private fields */ }Expand description
VirtualPathFileSystem implementation backed by an MPQ archive.
The Storage must outlive this object — MpqFileSystem holds a non-owning reference to it.
Path separators: both ‘/’ and ‘\’ are accepted and treated identically. Filename comparison is case-insensitive, matching MPQ archive semantics.
Requires the whiteout_mpq CMake target.
Example: auto storage = mpq::Storage::open(“War3.mpq”); utils::MpqFileSystem fs(*storage); auto data = fs.readFile(“units\orc\grunt\grunt.mdx”);
Implementations§
Source§impl FileSystem
impl FileSystem
Sourcepub fn read_file(&self, path: &str) -> Bytes
pub fn read_file(&self, path: &str) -> Bytes
Read a file from the archive. Returns an empty vector if not found.
Sourcepub fn write_file(&mut self, path: &str, data: &[u8]) -> bool
pub fn write_file(&mut self, path: &str, data: &[u8]) -> bool
Write a file into the archive overlay. Changes are not persisted to disk until storage.save() is called on the underlying Storage.
Sourcepub fn file_exists(&self, path: &str) -> bool
pub fn file_exists(&self, path: &str) -> bool
Check if a file exists in the archive (including the write overlay).
Trait Implementations§
Auto Trait Implementations§
impl !Sync for FileSystem
impl Freeze for FileSystem
impl RefUnwindSafe for FileSystem
impl Unpin for FileSystem
impl UnsafeUnpin for FileSystem
impl UnwindSafe for FileSystem
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