known_folders

Function get_known_folder_path

Source
pub fn get_known_folder_path(known_folder: KnownFolder) -> Option<PathBuf>
Expand description

Retrieve the full path of a known folder identified by the folder’s KNOWNFOLDERID.

A safe wrapper around the SHGetKnownFolderPath Win32 API function on Windows.

See KnownFolder for the types of known folders this function can retrieve.

§Errors

If an error occurs when calling the underlying Windows APIs or the given Known Folder ID is not present on the system (for example, if the ID was introduced in a newer OS version), None is returned.

§Examples

use known_folders::{get_known_folder_path, KnownFolder};

let profile_dir = get_known_folder_path(KnownFolder::Profile);