Detecting the insertion of an optical disk

I need to do some activity in a Xojo console application (that is running as a daemon) whenever an optical disk is inserted. Does anyone have any idea how to go about this? It has to work on Linux and macOS. Windows is optional.


with or without plugins ?
There are macOS API’s under disk arbitration for watching for disk mounts & unmounts

Windows has similar API’s

Not sure about Linux

For Windows check our WindowsDiskChangeMBS class in MBS Xojo Win Plugin.

For MacOS you can check NSWorkspaceMBS class with NSWorkspaceDidMountNotification to get the notification for a new disk.
Or CarbonApplicationEventsMBS for older projects where VolumeMounted event should still work.

Helpful links guys. Thanks.

Anyone know about Linux?

I just googled for “macOS detect disk insertion” and “windows detect disk insertion”

linux should be similar to find answers BUT you’re likely to get answers that vary from distro to distro - I find that to be really common in the linux world

for instance