Trait MediaDirsExt

pub trait MediaDirsExt: Sized

Windows-specific extensions to fs::MediaDirs.

Required Methods

fn known_folders() -> Result<Self>

Load the known user folder paths using the Known Folders API.

The loaded known folders are:

MediaDirs KNOWNFOLDERID
desktop FOLDERID_Desktop (%USERPROFILE%\Desktop)
documents FOLDERID_Documents (%USERPROFILE%\Documents)
downloads FOLDERID_Downloads (%USERPROFILE%\Downloads)
music FOLDERID_Music (%USERPROFILE%\Music)
pictures FOLDERID_Pictures (%USERPROFILE%\Pictures)
videos FOLDERID_Videos (%USERPROFILE%\Videos)

Errors

Errors if the underlying system discovery API returns an error. The lack of a configured path is not considered an error and results in a None value.

Implementation-specific behavior

Calls SHGetKnownFolderPath for the current user once for each known folder. Does not create the folder if missing.

COM should be initialized on the thread that calls this function or else it may return unexpected errors.

This behavior may change in the future. One example change that we explicitly reserve the right to make is to load additional common directories not currently in this list.