| 1 | extern crate option_extrust-analyzer cargo dirs-sys 0.5.0 option_ext/; |
| 2 | |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#; |
| 4 | 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#; |
| 5 | |
| 6 | // we don't need to explicitly handle empty strings in the code above, |
| 7 | // because an empty string is not considered to be a absolute path here. |
| 8 | pub fn is_absolute_pathrust-analyzer cargo dirs-sys 0.5.0 is_absolute_path().(path: OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#) -> 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#> { |
| 9 | let path = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<OsString>`]from().(path); |
| 10 | if path.is_absoluterust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]is_absolute().() { |
| 11 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path) |
| 12 | } else { |
| 13 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | #[cfg(all(unix, not(target_os = "redox")))] |
| 18 | extern crate libcrust-analyzer cargo dirs-sys 0.5.0 libc/; |
| 19 | |
| 20 | #[cfg(all(unix, not(target_os = "redox")))] |
| 21 | mod target_unix_not_redoxrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/ { |
| 22 | |
| 23 | 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/; |
| 24 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::{CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#, OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#}; |
| 25 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/; |
| 26 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/::OsStringExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/OsStringExt#; |
| 27 | 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#; |
| 28 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/; |
| 29 | |
| 30 | use superrust-analyzer cargo dirs-sys 0.5.0 crate/::libcrust-analyzer cargo libc 0.2.189 crate/; |
| 31 | |
| 32 | // https://github.com/rust-lang/rust/blob/2682b88c526d493edeb2d3f2df358f44db69b73f/library/std/src/sys/unix/os.rs#L595 |
| 33 | pub fn home_dirrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/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#> { |
| 34 | return 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().("HOME") |
| 35 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|h| if h.is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]is_empty().() { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# } else { Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(h) }) |
| 36 | .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| unsafe { fallbackrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/fallback().() }) |
| 37 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<OsString>`]from().); |
| 38 | |
| 39 | #[cfg(any(target_os = "android", target_os = "ios", target_os = "emscripten"))] |
| 40 | unsafe fn fallback() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#> { |
| 41 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 42 | } |
| 43 | #[cfg(not(any(target_os = "android", target_os = "ios", target_os = "emscripten")))] |
| 44 | unsafe fn fallbackrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/fallback().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#> { |
| 45 | let amt = match libcrust-analyzer cargo libc 0.2.189 crate/::sysconfrust-analyzer cargo libc 0.2.189 sysconf().(libcrust-analyzer cargo libc 0.2.189 crate/::_SC_GETPW_R_SIZE_MAXrust-analyzer cargo libc 0.2.189 unix/linux_like/linux_l4re_shared/_SC_GETPW_R_SIZE_MAX.) { |
| 46 | n if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]lt().0 => 512 as usize, |
| 47 | n => n as usize, |
| 48 | }; |
| 49 | let mut buf = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(amt); |
| 50 | let mut passwd: libcrust-analyzer cargo libc 0.2.189 crate/::passwdrust-analyzer cargo libc 0.2.189 unix/linux_like/linux_l4re_shared/passwd# = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().(); |
| 51 | let mut result = ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(); |
| 52 | match libcrust-analyzer cargo libc 0.2.189 crate/::getpwuid_rrust-analyzer cargo libc 0.2.189 getpwuid_r().( |
| 53 | libcrust-analyzer cargo libc 0.2.189 crate/::getuidrust-analyzer cargo libc 0.2.189 getuid().(), |
| 54 | &mut passwd, |
| 55 | buf.as_mut_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_mut_ptr().(), |
| 56 | buf.capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]capacity().(), |
| 57 | &mut result, |
| 58 | ) { |
| 59 | 0 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().result.is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]is_null().() => { |
| 60 | let ptr = passwd.pw_dirrust-analyzer cargo libc 0.2.189 unix/linux_like/linux_l4re_shared/passwd#pw_dir. as *const _; |
| 61 | let bytes = CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_ptr().(ptr).to_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]to_bytes().(); |
| 62 | if bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 63 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 64 | } else { |
| 65 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(OsStringExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/OsStringExt#::from_vecrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsString][OsStringExt]from_vec().(bytes.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().())) |
| 66 | } |
| 67 | } |
| 68 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | } |
| 74 | |
| 75 | #[cfg(all(unix, not(target_os = "redox")))] |
| 76 | pub use selfrust-analyzer cargo dirs-sys 0.5.0 crate/::target_unix_not_redoxrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/::home_dirrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/home_dir().; |
| 77 | |
| 78 | #[cfg(target_os = "redox")] |
| 79 | extern crate redox_users; |
| 80 | |
| 81 | #[cfg(target_os = "redox")] |
| 82 | mod target_redox { |
| 83 | |
| 84 | 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#; |
| 85 | |
| 86 | use super::redox_users::{All, AllUsers, Config}; |
| 87 | |
| 88 | pub fn 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#> { |
| 89 | let current_uid = redox_users::get_uid().ok()?; |
| 90 | let users = AllUsers::basic(Config::default()).ok()?; |
| 91 | let user = users.get_by_id(current_uid)?; |
| 92 | |
| 93 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::from(user.home.clone())) |
| 94 | } |
| 95 | |
| 96 | } |
| 97 | |
| 98 | #[cfg(target_os = "redox")] |
| 99 | pub use selfrust-analyzer cargo dirs-sys 0.5.0 crate/::target_redox::home_dir; |
| 100 | |
| 101 | #[cfg(all(unix, not(any(target_os = "macos", target_os = "ios"))))] |
| 102 | mod xdg_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/; |
| 103 | |
| 104 | #[cfg(all(unix, not(any(target_os = "macos", target_os = "ios"))))] |
| 105 | mod target_unix_not_macrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/ { |
| 106 | |
| 107 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#; |
| 108 | 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/; |
| 109 | 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/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 110 | |
| 111 | use superrust-analyzer cargo dirs-sys 0.5.0 crate/::{home_dirrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/home_dir()., is_absolute_pathrust-analyzer cargo dirs-sys 0.5.0 is_absolute_path().}; |
| 112 | use superrust-analyzer cargo dirs-sys 0.5.0 crate/::xdg_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/; |
| 113 | |
| 114 | fn user_dir_filerust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/user_dir_file().(home_dir: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf# { |
| 115 | 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().(is_absolute_pathrust-analyzer cargo dirs-sys 0.5.0 is_absolute_path().).unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| home_dir.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(".config")).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("user-dirs.dirs") |
| 116 | } |
| 117 | |
| 118 | // this could be optimized further to not create a map and instead retrieve the requested path only |
| 119 | pub fn user_dirrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/user_dir().(user_dir_name: &str) -> 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#> { |
| 120 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(home_dir) = home_dirrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_redox/home_dir().() { |
| 121 | xdg_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/::singlerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/single().(&home_dir, &user_dir_filerust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/user_dir_file().(&home_dir), user_dir_name).removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]remove().(user_dir_name) |
| 122 | } else { |
| 123 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | pub fn user_dirsrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/user_dirs().(home_dir_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { |
| 128 | xdg_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/::allrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/all().(home_dir_path, &user_dir_filerust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/user_dir_file().(home_dir_path)) |
| 129 | } |
| 130 | |
| 131 | } |
| 132 | |
| 133 | #[cfg(all(unix, not(any(target_os = "macos", target_os = "ios"))))] |
| 134 | pub use selfrust-analyzer cargo dirs-sys 0.5.0 crate/::target_unix_not_macrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/::{user_dirrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/user_dir()., user_dirsrust-analyzer cargo dirs-sys 0.5.0 target_unix_not_mac/user_dirs().}; |
| 135 | |
| 136 | #[cfg(target_os = "windows")] |
| 137 | extern crate windows_sys as windows; |
| 138 | |
| 139 | #[cfg(target_os = "windows")] |
| 140 | mod target_windows { |
| 141 | |
| 142 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#; |
| 143 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#; |
| 144 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::windows::ffi::OsStringExt; |
| 145 | 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#; |
| 146 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/; |
| 147 | |
| 148 | use super::windows::Win32::UI::Shell; |
| 149 | |
| 150 | pub fn known_folder(folder_id: windows::core::GUID) -> 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#> { |
| 151 | unsafe { |
| 152 | let mut path_ptr: windows::core::PWSTR = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(); |
| 153 | let result = Shell::SHGetKnownFolderPath( |
| 154 | &folder_id, |
| 155 | 0, |
| 156 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(), |
| 157 | &mut path_ptr |
| 158 | ); |
| 159 | if result == 0 { |
| 160 | let len = windows::Win32::Globalization::lstrlenW(path_ptr) as usize; |
| 161 | let path = slice::from_raw_parts(path_ptr, len); |
| 162 | let ostr: OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString# = OsStringExt::from_wide(path); |
| 163 | windows::Win32::System::Com::CoTaskMemFree(path_ptr as *const c_void); |
| 164 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::from(ostr)) |
| 165 | } else { |
| 166 | windows::Win32::System::Com::CoTaskMemFree(path_ptr as *const c_void); |
| 167 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | pub fn known_folder_profile() -> 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#> { |
| 173 | known_folder(Shell::FOLDERID_Profile) |
| 174 | } |
| 175 | |
| 176 | pub fn known_folder_roaming_app_data() -> 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#> { |
| 177 | known_folder(Shell::FOLDERID_RoamingAppData) |
| 178 | } |
| 179 | |
| 180 | pub fn known_folder_local_app_data() -> 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#> { |
| 181 | known_folder(Shell::FOLDERID_LocalAppData) |
| 182 | } |
| 183 | |
| 184 | pub fn known_folder_music() -> 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#> { |
| 185 | known_folder(Shell::FOLDERID_Music) |
| 186 | } |
| 187 | |
| 188 | pub fn known_folder_desktop() -> 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#> { |
| 189 | known_folder(Shell::FOLDERID_Desktop) |
| 190 | } |
| 191 | |
| 192 | pub fn known_folder_documents() -> 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#> { |
| 193 | known_folder(Shell::FOLDERID_Documents) |
| 194 | } |
| 195 | |
| 196 | pub fn known_folder_downloads() -> 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#> { |
| 197 | known_folder(Shell::FOLDERID_Downloads) |
| 198 | } |
| 199 | |
| 200 | pub fn known_folder_pictures() -> 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#> { |
| 201 | known_folder(Shell::FOLDERID_Pictures) |
| 202 | } |
| 203 | |
| 204 | pub fn known_folder_public() -> 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#> { |
| 205 | known_folder(Shell::FOLDERID_Public) |
| 206 | } |
| 207 | pub fn known_folder_templates() -> 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#> { |
| 208 | known_folder(Shell::FOLDERID_Templates) |
| 209 | } |
| 210 | pub fn known_folder_videos() -> 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#> { |
| 211 | known_folder(Shell::FOLDERID_Videos) |
| 212 | } |
| 213 | |
| 214 | } |
| 215 | |
| 216 | #[cfg(target_os = "windows")] |
| 217 | pub use selfrust-analyzer cargo dirs-sys 0.5.0 crate/::target_windows::{ |
| 218 | known_folder, known_folder_profile, known_folder_roaming_app_data, known_folder_local_app_data, |
| 219 | known_folder_music, known_folder_desktop, known_folder_documents, known_folder_downloads, |
| 220 | known_folder_pictures, known_folder_public, known_folder_templates, known_folder_videos |
| 221 | }; |