docs: Improve BaseDirectory documentation (#13043)

* add notes

* Add links

* fix fmt
This commit is contained in:
Lőrik Levente 2025-03-21 12:57:34 +01:00 committed by GitHub
parent be3a79c864
commit dea8bbf6cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 88 additions and 1 deletions

View File

@ -83,28 +83,40 @@ impl<'de> Deserialize<'de> for SafePathBuf {
#[non_exhaustive]
pub enum BaseDirectory {
/// The Audio directory.
/// Resolves to [`crate::path::PathResolver::audio_dir`].
Audio = 1,
/// The Cache directory.
/// Resolves to [`crate::path::PathResolver::cache_dir`].
Cache = 2,
/// The Config directory.
/// Resolves to [`crate::path::PathResolver::config_dir`].
Config = 3,
/// The Data directory.
/// Resolves to [`crate::path::PathResolver::data_dir`].
Data = 4,
/// The LocalData directory.
/// Resolves to [`crate::path::PathResolver::local_data_dir`].
LocalData = 5,
/// The Document directory.
/// Resolves to [`crate::path::PathResolver::document_dir`].
Document = 6,
/// The Download directory.
/// Resolves to [`crate::path::PathResolver::download_dir`].
Download = 7,
/// The Picture directory.
/// Resolves to [`crate::path::PathResolver::picture_dir`].
Picture = 8,
/// The Public directory.
/// Resolves to [`crate::path::PathResolver::public_dir`].
Public = 9,
/// The Video directory.
/// Resolves to [`crate::path::PathResolver::video_dir`].
Video = 10,
/// The Resource directory.
/// Resolves to the resource directory of this app.
Resource = 11,
/// A temporary directory. Resolves to [`std::env::temp_dir`].
/// A temporary directory.
/// Resolves to [`std::env::temp_dir`].
Temp = 12,
/// The default app config directory.
/// Resolves to [`BaseDirectory::Config`]`/{bundle_identifier}`.
@ -123,20 +135,26 @@ pub enum BaseDirectory {
/// and [`BaseDirectory::Config`]`/{bundle_identifier}/logs` on linux and Windows.
AppLog = 17,
/// The Desktop directory.
/// Resolves to [`crate::path::PathResolver::desktop_dir`].
#[cfg(not(target_os = "android"))]
Desktop = 18,
/// The Executable directory.
/// Resolves to [`crate::path::PathResolver::executable_dir`].
#[cfg(not(target_os = "android"))]
Executable = 19,
/// The Font directory.
/// Resolves to [`crate::path::PathResolver::font_dir`].
#[cfg(not(target_os = "android"))]
Font = 20,
/// The Home directory.
/// Resolves to [`crate::path::PathResolver::home_dir`].
Home = 21,
/// The Runtime directory.
/// Resolves to [`crate::path::PathResolver::runtime_dir`].
#[cfg(not(target_os = "android"))]
Runtime = 22,
/// The Template directory.
/// Resolves to [`crate::path::PathResolver::template_dir`].
#[cfg(not(target_os = "android"))]
Template = 23,
}

View File

@ -17,28 +17,97 @@ import { invoke } from './core'
* @since 2.0.0
*/
enum BaseDirectory {
/**
* @see {@link audioDir} for more information.
*/
Audio = 1,
/**
* @see {@link cacheDir} for more information.
*/
Cache = 2,
/**
* @see {@link configDir} for more information.
*/
Config = 3,
/**
* @see {@link dataDir} for more information.
*/
Data = 4,
/**
* @see {@link localDataDir} for more information.
*/
LocalData = 5,
/**
* @see {@link documentDir} for more information.
*/
Document = 6,
/**
* @see {@link downloadDir} for more information.
*/
Download = 7,
/**
* @see {@link pictureDir} for more information.
*/
Picture = 8,
/**
* @see {@link publicDir} for more information.
*/
Public = 9,
/**
* @see {@link videoDir} for more information.
*/
Video = 10,
/**
* @see {@link resourceDir} for more information.
*/
Resource = 11,
/**
* @see {@link tempDir} for more information.
*/
Temp = 12,
/**
* @see {@link appConfigDir} for more information.
*/
AppConfig = 13,
/**
* @see {@link appDataDir} for more information.
*/
AppData = 14,
/**
* @see {@link appLocalDataDir} for more information.
*/
AppLocalData = 15,
/**
* @see {@link appCacheDir} for more information.
*/
AppCache = 16,
/**
* @see {@link appLogDir} for more information.
*/
AppLog = 17,
/**
* @see {@link desktopDir} for more information.
*/
Desktop = 18,
/**
* @see {@link executableDir} for more information.
*/
Executable = 19,
/**
* @see {@link fontDir} for more information.
*/
Font = 20,
/**
* @see {@link homeDir} for more information.
*/
Home = 21,
/**
* @see {@link runtimeDir} for more information.
*/
Runtime = 22,
/**
* @see {@link templateDir} for more information.
*/
Template = 23
}