PlaydateFileSystem

Struct PlaydateFileSystem 

Source
pub struct PlaydateFileSystem { /* private fields */ }

Implementations§

Source§

impl PlaydateFileSystem

Source

pub fn get_error(&self) -> Option<Error>

Returns human-readable text describing the most recent error (usually indicated by a -1 return from a filesystem function).

Source

pub fn list_files( &self, path: impl AsRef<str>, show_hidden: bool, callback: impl FnMut(&str), ) -> Result<(), Error>

Calls the given callback function for every file at path. Subfolders are indicated by a trailing slash ‘/’ in filename. listfiles() does not recurse into subfolders. If showhidden is set, files beginning with a period will be included; otherwise, they are skipped. Returns 0 on success, -1 if no folder exists at path or it can’t be opened.

Source

pub fn stat(&self, path: impl AsRef<str>) -> Result<FileStat>

Populates the FileStat stat with information about the file at path. Returns 0 on success, or -1 in case of error.

Source

pub fn mkdir(&self, path: impl AsRef<str>) -> Result<()>

Creates the given path in the Data/<gameid> folder. It does not create intermediate folders. Returns 0 on success, or -1 in case of error.

Deletes the file at path. Returns 0 on success, or -1 in case of error. If recursive is 1 and the target path is a folder, this deletes everything inside the folder (including folders, folders inside those, and so on) as well as the folder itself.

Source

pub fn rename(&self, from: impl AsRef<str>, to: impl AsRef<str>) -> Result<()>

Renames the file at from to to. It will overwrite the file at to without confirmation. It does not create intermediate folders. Returns 0 on success, or -1 in case of error.

Source

pub fn open(&self, name: impl AsRef<str>, mode: FileOptions) -> Result<File>

Opens a handle for the file at path. The kFileRead mode opens a file in the game pdx, while kFileReadData searches the game’s data folder; to search the data folder first then fall back on the game pdx, use the bitwise combination kFileRead|kFileReadData.kFileWrite and kFileAppend always write to the data folder. The function returns NULL if a file at path cannot be opened, and playdate->file->geterr() will describe the error. The filesystem has a limit of 64 simultaneous open files.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.