dmg
Simple attaching/detaching of macOS disk images.
Example
Attach a disk image until dropped:
use Attach;
let info = new.with.expect;
println!;
// Detched when 'info' dropped
If you prefer to handle detaching yourself simply use attach()
:
use Attach;
let info = new.attach.expect;
println!;
info.detach.expect; // There is also .force_detach()
If you know the device node or mount point, you can detach it like this too:
use dmg;
detach.expect; // Do not force detach
For more examples see src/tests.rs
and src/bin/demo.rs
Testing
To create Test.dmg
run:
This will create a read-write .dmg file containg a single file called SAMPLE
.
hdiutil
doesn not like attaching and detaching the same file concurrently, so test using:
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.