#path #folders #windows

windirs

SHGetKnownFolderPath 的安全包装

3个版本 (稳定版)

1.0.1 2021年3月6日
0.1.0 2021年3月6日

#147Windows API

Download history 116/week @ 2024-03-15 125/week @ 2024-03-22 137/week @ 2024-03-29 228/week @ 2024-04-05 161/week @ 2024-04-12 108/week @ 2024-04-19 214/week @ 2024-04-26 210/week @ 2024-05-03 178/week @ 2024-05-10 181/week @ 2024-05-17 158/week @ 2024-05-24 227/week @ 2024-05-31 262/week @ 2024-06-07 192/week @ 2024-06-14 340/week @ 2024-06-21 136/week @ 2024-06-28

每月下载量 966
7 个Crate中使用(通过 pathos

Apache-2.0 OR MIT

12KB
354

windirs

Documentation

SHGetKnownFolderPath 的安全包装。

使用方法

use windirs::{Error, FolderId, get_known_folder};

let local_app_data_path = match get_known_folder(FolderId::LocalAppData) {
    Ok(path) => path,
    Err(err) => match err {
        // Some folder ids point to virtual paths, so, yeah.
        Error::Virtual => panic!(),
        // When no folder is found.
        Error::NotFound => panic!(),
        // Can occur for a variety of reasons, such as this folder id being unknown to this OS.
        Error::InvalidArg(io_error) => panic!(),
        // Any other potential OS error that could happen, but is not defined by the API.
        Error::Other(io_error) => panic!(),
    }
}

let user_home_path = get_known_folder(FolderId::Profile).unwrap();

许可证

该项目可以在以下任一许可证下使用

任选其一。

依赖

~225KB