| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#; |
| 3 | |
| 4 | pub fn home_dirrust-analyzer cargo dirs-next 2.0.0 lin/home_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::home_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_redox/home_dir().() } |
| 5 | pub fn cache_dirrust-analyzer cargo dirs-next 2.0.0 lin/cache_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("XDG_CACHE_HOME") .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::is_absolute_pathrust-analyzer cargo dirs-sys-next 0.1.2 is_absolute_path().).or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| home_dirrust-analyzer cargo dirs-next 2.0.0 lin/home_dir().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|h| h.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(".cache"))) } |
| 6 | pub fn config_dirrust-analyzer cargo dirs-next 2.0.0 lin/config_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("XDG_CONFIG_HOME").and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::is_absolute_pathrust-analyzer cargo dirs-sys-next 0.1.2 is_absolute_path().).or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| home_dirrust-analyzer cargo dirs-next 2.0.0 lin/home_dir().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|h| h.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(".config"))) } |
| 7 | pub fn data_dirrust-analyzer cargo dirs-next 2.0.0 lin/data_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("XDG_DATA_HOME") .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::is_absolute_pathrust-analyzer cargo dirs-sys-next 0.1.2 is_absolute_path().).or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| home_dirrust-analyzer cargo dirs-next 2.0.0 lin/home_dir().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|h| h.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(".local/share"))) } |
| 8 | pub fn data_local_dirrust-analyzer cargo dirs-next 2.0.0 lin/data_local_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { data_dirrust-analyzer cargo dirs-next 2.0.0 lin/data_dir().() } |
| 9 | pub fn runtime_dirrust-analyzer cargo dirs-next 2.0.0 lin/runtime_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("XDG_RUNTIME_DIR").and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::is_absolute_pathrust-analyzer cargo dirs-sys-next 0.1.2 is_absolute_path().) } |
| 10 | pub fn executable_dirrust-analyzer cargo dirs-next 2.0.0 lin/executable_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { |
| 11 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("XDG_BIN_HOME").and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::is_absolute_pathrust-analyzer cargo dirs-sys-next 0.1.2 is_absolute_path().).or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| { |
| 12 | data_dirrust-analyzer cargo dirs-next 2.0.0 lin/data_dir().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|mut e| { e.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().(); e.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().("bin"); e }) |
| 13 | }) |
| 14 | } |
| 15 | pub fn audio_dirrust-analyzer cargo dirs-next 2.0.0 lin/audio_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("MUSIC") } |
| 16 | pub fn desktop_dirrust-analyzer cargo dirs-next 2.0.0 lin/desktop_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("DESKTOP") } |
| 17 | pub fn document_dirrust-analyzer cargo dirs-next 2.0.0 lin/document_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("DOCUMENTS") } |
| 18 | pub fn download_dirrust-analyzer cargo dirs-next 2.0.0 lin/download_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("DOWNLOAD") } |
| 19 | pub fn font_dirrust-analyzer cargo dirs-next 2.0.0 lin/font_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { data_dirrust-analyzer cargo dirs-next 2.0.0 lin/data_dir().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|d| d.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("fonts")) } |
| 20 | pub fn picture_dirrust-analyzer cargo dirs-next 2.0.0 lin/picture_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("PICTURES") } |
| 21 | pub fn public_dirrust-analyzer cargo dirs-next 2.0.0 lin/public_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("PUBLICSHARE") } |
| 22 | pub fn template_dirrust-analyzer cargo dirs-next 2.0.0 lin/template_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("TEMPLATES") } |
| 23 | pub fn video_dirrust-analyzer cargo dirs-next 2.0.0 lin/video_dir().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { dirs_sys_nextrust-analyzer cargo dirs-sys-next 0.1.2 crate/::user_dirrust-analyzer cargo dirs-sys-next 0.1.2 target_unix_not_mac/user_dir().("VIDEOS") } |
| 24 | |
| 25 | #[cfg(test)] |
| 26 | mod testsrust-analyzer cargo dirs-next 2.0.0 lin/tests/ { |
| 27 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 28 | fn test_file_user_dirs_existsrust-analyzer cargo dirs-next 2.0.0 lin/tests/test_file_user_dirs_exists().() { |
| 29 | let user_dirs_file = craterust-analyzer cargo dirs-next 2.0.0 crate/::config_dirrust-analyzer cargo dirs-next 2.0.0 config_dir().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("user-dirs.dirs"); |
| 30 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?} exists: {:?}", user_dirs_file, user_dirs_file.existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().()); |
| 31 | } |
| 32 | } |