#[repr(C)]pub struct FilePath {
pub inner: AzString,
}Expand description
FFI-safe path type with OOP-style methods
This wraps a string path and provides method-based access to file operations.
Fields§
§inner: AzStringImplementations§
Source§impl FilePath
impl FilePath
Sourcepub fn get_temp_dir() -> Self
pub fn get_temp_dir() -> Self
Returns the system temporary directory
Sourcepub fn get_current_dir() -> Result<FilePath, FileError>
pub fn get_current_dir() -> Result<FilePath, FileError>
Returns the current working directory
Sourcepub fn get_home_dir() -> Option<FilePath>
pub fn get_home_dir() -> Option<FilePath>
Returns the user’s home directory (e.g., /home/username on Linux, C:\Users\username on Windows)
Sourcepub fn get_cache_dir() -> Option<FilePath>
pub fn get_cache_dir() -> Option<FilePath>
Returns the user’s cache directory (e.g., ~/.cache on Linux, ~/Library/Caches on macOS)
Sourcepub fn get_config_dir() -> Option<FilePath>
pub fn get_config_dir() -> Option<FilePath>
Returns the user’s config directory (e.g., ~/.config on Linux, ~/Library/Application Support on macOS)
Sourcepub fn get_config_local_dir() -> Option<FilePath>
pub fn get_config_local_dir() -> Option<FilePath>
Returns the user’s local config directory (e.g., ~/.config on Linux, ~/Library/Application Support on macOS)
Sourcepub fn get_data_dir() -> Option<FilePath>
pub fn get_data_dir() -> Option<FilePath>
Returns the user’s data directory (e.g., ~/.local/share on Linux, ~/Library/Application Support on macOS)
Sourcepub fn get_data_local_dir() -> Option<FilePath>
pub fn get_data_local_dir() -> Option<FilePath>
Returns the user’s local data directory (e.g., ~/.local/share on Linux, ~/Library/Application Support on macOS)
Sourcepub fn get_desktop_dir() -> Option<FilePath>
pub fn get_desktop_dir() -> Option<FilePath>
Returns the user’s desktop directory (e.g., ~/Desktop)
Sourcepub fn get_document_dir() -> Option<FilePath>
pub fn get_document_dir() -> Option<FilePath>
Returns the user’s documents directory (e.g., ~/Documents)
Sourcepub fn get_download_dir() -> Option<FilePath>
pub fn get_download_dir() -> Option<FilePath>
Returns the user’s downloads directory (e.g., ~/Downloads)
Sourcepub fn get_executable_dir() -> Option<FilePath>
pub fn get_executable_dir() -> Option<FilePath>
Returns the user’s executable directory (e.g., ~/.local/bin on Linux)
Sourcepub fn get_font_dir() -> Option<FilePath>
pub fn get_font_dir() -> Option<FilePath>
Returns the user’s font directory (e.g., ~/.local/share/fonts on Linux, ~/Library/Fonts on macOS)
Sourcepub fn get_picture_dir() -> Option<FilePath>
pub fn get_picture_dir() -> Option<FilePath>
Returns the user’s pictures directory (e.g., ~/Pictures)
Sourcepub fn get_preference_dir() -> Option<FilePath>
pub fn get_preference_dir() -> Option<FilePath>
Returns the user’s preference directory (e.g., ~/.config on Linux, ~/Library/Preferences on macOS)
Sourcepub fn get_public_dir() -> Option<FilePath>
pub fn get_public_dir() -> Option<FilePath>
Returns the user’s public directory (e.g., ~/Public)
Sourcepub fn get_runtime_dir() -> Option<FilePath>
pub fn get_runtime_dir() -> Option<FilePath>
Returns the user’s runtime directory (e.g., /run/user/1000 on Linux)
Sourcepub fn get_state_dir() -> Option<FilePath>
pub fn get_state_dir() -> Option<FilePath>
Returns the user’s state directory (e.g., ~/.local/state on Linux)
Sourcepub fn get_audio_dir() -> Option<FilePath>
pub fn get_audio_dir() -> Option<FilePath>
Returns the user’s audio directory (e.g., ~/Music)
Sourcepub fn get_video_dir() -> Option<FilePath>
pub fn get_video_dir() -> Option<FilePath>
Returns the user’s video directory (e.g., ~/Videos)
Sourcepub fn get_template_dir() -> Option<FilePath>
pub fn get_template_dir() -> Option<FilePath>
Returns the user’s templates directory
Sourcepub fn join_str(&self, component: &AzString) -> FilePath
pub fn join_str(&self, component: &AzString) -> FilePath
Joins this path with a string component
Sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Checks if the path is absolute
Sourcepub fn create_dir_all(&self) -> Result<Void, FileError>
pub fn create_dir_all(&self) -> Result<Void, FileError>
Creates this directory and all parent directories
Sourcepub fn create_dir(&self) -> Result<Void, FileError>
pub fn create_dir(&self) -> Result<Void, FileError>
Creates this directory (parent must exist)
Sourcepub fn remove_file(&self) -> Result<Void, FileError>
pub fn remove_file(&self) -> Result<Void, FileError>
Removes this file
Sourcepub fn remove_dir(&self) -> Result<Void, FileError>
pub fn remove_dir(&self) -> Result<Void, FileError>
Removes this directory (must be empty)
Sourcepub fn remove_dir_all(&self) -> Result<Void, FileError>
pub fn remove_dir_all(&self) -> Result<Void, FileError>
Removes this directory and all contents
Sourcepub fn read_bytes(&self) -> Result<U8Vec, FileError>
pub fn read_bytes(&self) -> Result<U8Vec, FileError>
Reads the entire file at this path as bytes
Sourcepub fn read_string(&self) -> Result<AzString, FileError>
pub fn read_string(&self) -> Result<AzString, FileError>
Reads the entire file at this path as a string
Sourcepub fn write_bytes(&self, data: &U8Vec) -> Result<Void, FileError>
pub fn write_bytes(&self, data: &U8Vec) -> Result<Void, FileError>
Writes bytes to the file at this path
Sourcepub fn write_string(&self, data: &AzString) -> Result<Void, FileError>
pub fn write_string(&self, data: &AzString) -> Result<Void, FileError>
Writes a string to the file at this path
Sourcepub fn copy_to(&self, dest: &FilePath) -> Result<u64, FileError>
pub fn copy_to(&self, dest: &FilePath) -> Result<u64, FileError>
Copies a file from this path to another path
Sourcepub fn rename_to(&self, dest: &FilePath) -> Result<Void, FileError>
pub fn rename_to(&self, dest: &FilePath) -> Result<Void, FileError>
Renames/moves a file from this path to another path
Sourcepub fn read_dir(&self) -> Result<DirEntryVec, FileError>
pub fn read_dir(&self) -> Result<DirEntryVec, FileError>
Lists directory contents
Sourcepub fn metadata(&self) -> Result<FileMetadata, FileError>
pub fn metadata(&self) -> Result<FileMetadata, FileError>
Returns metadata about the file/directory
Sourcepub fn canonicalize(&self) -> Result<FilePath, FileError>
pub fn canonicalize(&self) -> Result<FilePath, FileError>
Makes the path canonical (absolute, with no . or .. components)
Trait Implementations§
impl Eq for FilePath
impl StructuralPartialEq for FilePath
Auto Trait Implementations§
impl Freeze for FilePath
impl RefUnwindSafe for FilePath
impl Send for FilePath
impl Sync for FilePath
impl Unpin for FilePath
impl UnwindSafe for FilePath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more