Skip to main content

data_dirs

Function data_dirs 

Source
pub fn data_dirs() -> XdgDirsIter 
🔬This is a nightly-only experimental API. (xdg_basedir #157515)
Available on Unix only.
Expand description

A set of preference ordered directories relative to which data files should be searched.

If an application defines a data file to be at $XDG_DATA_DIRS/appid/file.name, this means that:

  • The initial data file should be installed to {system_data_dir}/appid/file.name.
  • A user-specific version of the data file may be created at {data_home_dir()}/appid/file.name.
  • Lookups for the data file should search for ./appid/file.name relative to data_home_dir and each directory in data_dirs, giving preference to files found relative to an earlier directory in the search order.

An application may choose to handle a file being located under multiple base directories however it sees fit, so long as it respects the search order. For example, it could say that only the first file found is used, or that data within the files is merged in some way.