views:

295

answers:

3

If I mount the DMG file using system calls to hdiutil and my application quits unexpectedly, the DMG remains mounted but because I mount it privately with -nobrowse, it doesn't show up in Finder. Is there a way to mount it using some framework or API that will be smart enough to unmount if my application unexpectedly quits?

Basically, I'm looking for a way to be able to read from files within a DMG without having to mount it.

+2  A: 

I think your best bet is to try to catch an exception or signal prior to exiting, and in your exception or signal handler code, unmount the DMG yourself.

Craig S
+1  A: 

You could use libdmg to directly read the dmg rather than mounting it....though it's obviously unsupported.

vasi
A: 

Extract DMG for free on both windows and Mac OS X

Gadu
I'm not sure if relying on a third-party shareware application is the best approach.
dreamlax