Expand description
Simple attaching/detaching of macOS disk images.
§Example
Attach a disk image until dropped:
use dmg::Attach;
let info = Attach::new("Test.dmg").with().expect("could not attach");
println!("Mounted at {:?}", info.mount_point);
// Detched when 'info' dropped
If you prefer to handle detaching yourself simply use 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()
If you know the device node or mount point, you can detach it like this too:
use dmg;
dmg::detach("/Volumes/Test", false).expect("could not detach"); // Do not force detach
For more examples see src/tests.rs
and src/bin/demo.rs
Structs§
- Attach
- Builder to attach a disk image.
- Handle
- Convinience handle for detaching an attached disk image.
- Info
- Data associated with an attached disk image.
- With
- An attached disk image handle that detaches it when dropped.
Functions§
- detach
- Detach an image using a path.