OSX-Mounting DVD does not programmatically launch a user-specified application

I used the disk arbitration infrastructure to manage various disks and disks.

I registered the DADiskAppearedCallback and DADiskDisappearCallback callback functions.

For usb disks everything works fine, but for CD / DVD I ran into a problem.

After booting the CD / DVD, I have an unmount ( DADiskUnmount() ) disk using BSDName on the disk. Then, after some verification of the disk, I mount the ( DADiskMount() ) disk again using BSDName.

When I re-mount the CD / DVD, the default application installed in

system preferences-> Equipment-> Cds and DVS

does not start.

For example, For DVD video - Open DVD Player. This is where the DVD player should be running.

Please provide any suggestions to overcome this problem.

thanks

I'm still trying to find a solution, "SystemUIServer" controls the application that should be mounted when inserting the CD / DVD. Can I run this action on a CD / DVD? Or is this the right way to manually run a user-provided application on a CD / DVD?

+6
source share
1 answer

You can try to tickle 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 install the userInfo KVP dictionary accordingly. (In NSWorkspace docs)

Finally, send a notification to the Workspace Notification Center [NSWorkspace notificationCenter]

I suspect this might be a trick.

EDIT This doesn't sound like a trick

+1
source

Source: https://habr.com/ru/post/980631/


All Articles