문제

If you have a document open and want to unmount a volume, os x opens this alert panel, that the document is still in use by program x. How can you get notified about this in cocoa? I tried the DADiskArbitration framework, but this doesn't send a callback until the disk has successfully unmounted.

Have you any ideas?

도움이 되었습니까?

해결책

You could invoke lsof using NSTask to get a list of open files. Use lsof +D /Volumes/<volume name> to narrow the search down to files open in the mounted volume you're interested in.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top