I have used disk-arbitration framework for managing various drives and disks.
I have registered callback functions DADiskAppearedCallback
and DADiskDisappearCallback
.
For the usb drives all seems to work perfectly but for the CD/DVD I am facing the problem.
After CD/DVD get loaded I have unmount (DADiskUnmount()
) the drive using BSDName of the disk.
Then after some verification of the disk I do mount (DADiskMount()
) the disk again using BSDName.
When I mount CD/DVD again, the default application set in the
system preference->Hardware->Cds & DVSs
is not getting launch.
For eg. For Video DVD - Open DVD Player. Here DVD player should get launched.
How do I overcome this problem?
I am still searching for the solution came across, "SystemUIServer" manages the application that should mount on insertion of CD/DVD. Can I able to trigger that action on the CD/DVD mount? Or Is this proper way to manually launch user provided application on CD/DVD mount?
You might try tickling it with NSWorkSpace
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/index.html#//apple_ref/c/data/NSWorkspaceDidMountNotification
First create an NSNotification of type NSWorkspaceDidMountNotification
Be sure to set the userInfo dictionary KVPs as appropriate. (In the NSWorkspace docs)
Finally, post the notification to the workspace Notification Center [NSWorkspace notificationCenter]
I suspect that might be the trick.
EDIT This doesn't seem to do the trick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With