3 个版本

0.1.2 2022年12月27日
0.1.1 2017年6月22日
0.1.0 2017年6月22日

#44macOS和iOS API

Download history 378/week @ 2024-03-14 374/week @ 2024-03-21 384/week @ 2024-03-28 279/week @ 2024-04-04 250/week @ 2024-04-11 294/week @ 2024-04-18 412/week @ 2024-04-25 345/week @ 2024-05-02 279/week @ 2024-05-09 284/week @ 2024-05-16 372/week @ 2024-05-23 443/week @ 2024-05-30 358/week @ 2024-06-06 379/week @ 2024-06-13 409/week @ 2024-06-20 346/week @ 2024-06-27

1,550 每月下载量
5 个Crate中使用 (3个直接使用)

MIT/Apache

14KB
222

dmg

简单的 macOS 磁盘镜像附加/卸载。

Build Status crates.io Docs

示例

附加磁盘镜像直到释放

use dmg::Attach;
let info = Attach::new("Test.dmg").with().expect("could not attach");
println!("Mounted at {:?}", info.mount_point);
// Detched when 'info' dropped

如果您喜欢自己处理卸载,只需使用 attach()

use dmg::Attach;
let info = Attach::new("Test.dmg").attach().expect("could not attach");
println!("Device node {:?}", info.device);
info.detach().expect("could not detach"); // There is also .force_detach()

如果您知道设备节点或挂载点,您也可以这样卸载它

use dmg;
dmg::detach("/Volumes/Test", false).expect("could not detach"); // Do not force detach

更多示例请参阅 src/tests.rssrc/bin/demo.rs

测试

要创建 Test.dmg 运行

./create_dmg.sh

这将创建一个包含单个名为 SAMPLE 的文件的读/写 .dmg 文件。

hdiutil 不喜欢同时附加和卸载相同的文件,因此使用以下命令进行测试

cargo test -- --test-threads 1

许可证

以下两种许可证之一授权:

任选其一。

依赖关系

~3.5MB
~62K SLoC