[−][src]Struct gvfs::filesystem::Filesystem
A structure that contains the filesystem state and cache.
Methods
impl Filesystem
[src]
pub fn new(id: &str, author: &str) -> Result<Filesystem>
[src]
Create a new Filesystem
instance, using the given id
and (on
some platforms) the author
as a portion of the user
directory path. This function is called automatically by
ggez, the end user should never need to call it.
pub fn open<P: AsRef<Path>>(&mut self, path: P) -> Result<File>
[src]
Opens the given path
and returns the resulting File
in read-only mode.
pub fn open_options<P: AsRef<Path>>(
&mut self,
path: P,
options: OpenOptions
) -> Result<File>
[src]
&mut self,
path: P,
options: OpenOptions
) -> Result<File>
Opens a file in the user directory with the given
filesystem::OpenOptions
.
Note that even if you open a file read-write, it can only
write to files in the "user" directory.
pub fn create<P: AsRef<Path>>(&mut self, path: P) -> Result<File>
[src]
Creates a new file in the user directory and opens it to be written to, truncating it if it already exists.
pub fn create_dir<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
Create an empty directory in the user dir with the given name. Any parents to that directory that do not exist will be created.
pub fn delete<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
Deletes the specified file in the user dir.
pub fn delete_dir<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
Deletes the specified directory in the user dir, and all its contents!
pub fn exists<P: AsRef<Path>>(&self, path: P) -> bool
[src]
Check whether a file or directory exists.
pub fn is_file<P: AsRef<Path>>(&self, path: P) -> bool
[src]
Check whether a path points at a file.
pub fn is_dir<P: AsRef<Path>>(&self, path: P) -> bool
[src]
Check whether a path points at a directory.
pub fn read_dir<P: AsRef<Path>>(
&mut self,
path: P
) -> Result<Box<dyn Iterator<Item = PathBuf>>>
[src]
&mut self,
path: P
) -> Result<Box<dyn Iterator<Item = PathBuf>>>
Returns a list of all files and directories in the resource directory, in no particular order.
Lists the base directory if an empty path is given.
pub fn print_all(&mut self)
[src]
Prints the contents of all data directories to standard output. Useful for debugging.
pub fn log_all(&mut self)
[src]
Outputs the contents of all data directories,
using the "info" log level of the log
crate.
Useful for debugging.
pub fn mount(&mut self, path: &Path, readonly: bool)
[src]
Adds the given (absolute) path to the list of directories it will search to look for resources.
You probably shouldn't use this in the general case, since it is
harder than it looks to make it bulletproof across platforms.
But it can be very nice for debugging and dev purposes, such as
by pushing $CARGO_MANIFEST_DIR/resources
to it
pub fn add_zip_file<R: Read + Seek + 'static>(
&mut self,
reader: R
) -> Result<()>
[src]
&mut self,
reader: R
) -> Result<()>
Adds any object that implements Read + Seek as a zip file.
Note: This is not intended for system files for the same reasons as
for .mount()
. Rather, it can be used to read zip files from sources
such as std::io::Cursor::new(includes_bytes!(...))
in order to embed
resources into the game's executable.
Trait Implementations
Auto Trait Implementations
impl !Sync for Filesystem
impl !Send for Filesystem
impl Unpin for Filesystem
impl !RefUnwindSafe for Filesystem
impl !UnwindSafe for Filesystem
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,