Struct ghee::XDG_DIRS

source ·
pub struct XDG_DIRS { /* private fields */ }

Methods from Deref<Target = BaseDirectories>§

source

pub fn get_runtime_directory(&self) -> Result<&PathBuf, Error>

Returns the user-specific runtime directory (set by XDG_RUNTIME_DIR).

source

pub fn has_runtime_directory(&self) -> bool

Returns true if XDG_RUNTIME_DIR is available, false otherwise.

source

pub fn get_config_file<P>(&self, path: P) -> PathBufwhere P: AsRef<Path>,

Like place_config_file(), but does not create any directories.

source

pub fn get_data_file<P>(&self, path: P) -> PathBufwhere P: AsRef<Path>,

Like place_data_file(), but does not create any directories.

source

pub fn get_cache_file<P>(&self, path: P) -> PathBufwhere P: AsRef<Path>,

Like place_cache_file(), but does not create any directories.

source

pub fn get_state_file<P>(&self, path: P) -> PathBufwhere P: AsRef<Path>,

Like place_state_file(), but does not create any directories.

source

pub fn get_runtime_file<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like place_runtime_file(), but does not create any directories. If XDG_RUNTIME_DIR is not available, returns an error.

source

pub fn place_config_file<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Given a relative path path, returns an absolute path in XDG_CONFIG_HOME where a configuration file may be stored. Leading directories in the returned path are pre-created; if that is not possible, an error is returned.

source

pub fn place_data_file<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like place_config_file(), but for a data file in XDG_DATA_HOME.

source

pub fn place_cache_file<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like place_config_file(), but for a cache file in XDG_CACHE_HOME.

source

pub fn place_state_file<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like place_config_file(), but for an application state file in XDG_STATE_HOME.

source

pub fn place_runtime_file<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like place_config_file(), but for a runtime file in XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not available, returns an error.

source

pub fn find_config_file<P>(&self, path: P) -> Option<PathBuf>where P: AsRef<Path>,

Given a relative path path, returns an absolute path to an existing configuration file, or None. Searches XDG_CONFIG_HOME and then XDG_CONFIG_DIRS.

source

pub fn find_config_files<P>(&self, path: P) -> FileFindIteratorwhere P: AsRef<Path>,

Given a relative path path, returns an iterator yielding absolute paths to existing configuration files, in XDG_CONFIG_DIRS and XDG_CONFIG_HOME. Paths are produced in order from lowest priority to highest.

source

pub fn find_data_file<P>(&self, path: P) -> Option<PathBuf>where P: AsRef<Path>,

Given a relative path path, returns an absolute path to an existing data file, or None. Searches XDG_DATA_HOME and then XDG_DATA_DIRS.

source

pub fn find_data_files<P>(&self, path: P) -> FileFindIteratorwhere P: AsRef<Path>,

Given a relative path path, returns an iterator yielding absolute paths to existing data files, in XDG_DATA_DIRS and XDG_DATA_HOME. Paths are produced in order from lowest priority to highest.

source

pub fn find_cache_file<P>(&self, path: P) -> Option<PathBuf>where P: AsRef<Path>,

Given a relative path path, returns an absolute path to an existing cache file, or None. Searches XDG_CACHE_HOME.

source

pub fn find_state_file<P>(&self, path: P) -> Option<PathBuf>where P: AsRef<Path>,

Given a relative path path, returns an absolute path to an existing application state file, or None. Searches XDG_STATE_HOME.

source

pub fn find_runtime_file<P>(&self, path: P) -> Option<PathBuf>where P: AsRef<Path>,

Given a relative path path, returns an absolute path to an existing runtime file, or None. Searches XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not available, returns None.

source

pub fn create_config_directory<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Given a relative path path, returns an absolute path to a configuration directory in XDG_CONFIG_HOME. The directory and all directories leading to it are created if they did not exist; if that is not possible, an error is returned.

source

pub fn create_data_directory<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like create_config_directory(), but for a data directory in XDG_DATA_HOME.

source

pub fn create_cache_directory<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like create_config_directory(), but for a cache directory in XDG_CACHE_HOME.

source

pub fn create_state_directory<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like create_config_directory(), but for an application state directory in XDG_STATE_HOME.

source

pub fn create_runtime_directory<P>(&self, path: P) -> Result<PathBuf, Error>where P: AsRef<Path>,

Like create_config_directory(), but for a runtime directory in XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not available, returns an error.

source

pub fn list_config_files<P>(&self, path: P) -> Vec<PathBuf, Global>where P: AsRef<Path>,

Given a relative path path, list absolute paths to all files in directories with path path in XDG_CONFIG_HOME and XDG_CONFIG_DIRS.

source

pub fn list_config_files_once<P>(&self, path: P) -> Vec<PathBuf, Global>where P: AsRef<Path>,

Like list_config_files, but only the first occurence of every distinct filename is returned.

source

pub fn list_data_files<P>(&self, path: P) -> Vec<PathBuf, Global>where P: AsRef<Path>,

Given a relative path path, lists absolute paths to all files in directories with path path in XDG_DATA_HOME and XDG_DATA_DIRS.

source

pub fn list_data_files_once<P>(&self, path: P) -> Vec<PathBuf, Global>where P: AsRef<Path>,

Like list_data_files, but only the first occurence of every distinct filename is returned.

source

pub fn list_cache_files<P>(&self, path: P) -> Vec<PathBuf, Global>where P: AsRef<Path>,

Given a relative path path, lists absolute paths to all files in directories with path path in XDG_CACHE_HOME.

source

pub fn list_state_files<P>(&self, path: P) -> Vec<PathBuf, Global>where P: AsRef<Path>,

Given a relative path path, lists absolute paths to all files in directories with path path in XDG_STATE_HOME.

source

pub fn list_runtime_files<P>(&self, path: P) -> Vec<PathBuf, Global>where P: AsRef<Path>,

Given a relative path path, lists absolute paths to all files in directories with path path in XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not available, returns an empty Vec.

source

pub fn get_data_home(&self) -> PathBuf

Returns the user-specific data directory (set by XDG_DATA_HOME).

source

pub fn get_config_home(&self) -> PathBuf

Returns the user-specific configuration directory (set by XDG_CONFIG_HOME).

source

pub fn get_cache_home(&self) -> PathBuf

Returns the user-specific directory for non-essential (cached) data (set by XDG_CACHE_HOME).

source

pub fn get_state_home(&self) -> PathBuf

Returns the user-specific directory for application state data (set by XDG_STATE_HOME).

source

pub fn get_data_dirs(&self) -> Vec<PathBuf, Global>

Returns a preference ordered (preferred to less preferred) list of supplementary data directories, ordered by preference (set by XDG_DATA_DIRS).

source

pub fn get_config_dirs(&self) -> Vec<PathBuf, Global>

Returns a preference ordered (preferred to less preferred) list of supplementary configuration directories (set by XDG_CONFIG_DIRS).

Trait Implementations§

source§

impl Deref for XDG_DIRS

§

type Target = BaseDirectories

The resulting type after dereferencing.
source§

fn deref(&self) -> &BaseDirectories

Dereferences the value.
source§

impl LazyStatic for XDG_DIRS

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.