Because DiskArbitration is Unwieldy.
If you've ever had to do more with a disk than NSFileManager provides, you've felt the pain. DiskArbitration is C-based, requires C-style callbacks, and makes you look up what options to pass every single time. VolumeManager exists to save you that trouble. It is a pure Objective-C interface and implements the standard delegate/protocol model to allow you to keep cruisin' without dropping in a few hundred extra lines of C.
Getting Started
If you're looking for a list of all of the volumes currently mounted, it's easy:
NSArray* volumes = [[[VolumeManager alloc] init] mountedVolumes];
To eject a volume:
[[[VolumeManager alloc] init] unmountAndEjectVolumeAt:[NSURL fileURLWithPath:@"/path/to/mountpoint"]];
You get the idea.
Delegate Features
Because we're so nice, VolumeManager can inform your delegate of:
- Pending mount, unmount, and eject events
- Mount, unmount, and eject events as soon as they take place
Your delegate can also arbitrate mount, unmount, and eject requests, allowing you to choose if and when a volume is mounted, unmounted, or ejected.
Ready to get started? Check out the project and then dig into the docs
Authors and Contributors
This is the brainchild of Tom Metge (@tommetge), used in his unDock app, open sourced to the world because nobody else should have to suffer again.