Re: Running from DMG
Re: Running from DMG
- Subject: Re: Running from DMG
- From: "Jim Thomason" <email@hidden>
- Date: Sun, 11 Feb 2007 09:59:12 -0600
I don't think you need to get so fancy as to try using hdiutil to
unmount the volume the app is on. That seems...hackish.
Instead, how about using "hdiutil info -plist"? That'll give you
information about the currently mounted disk images, in a convenient
plist format. Check to see if your volume is in the list, and then you
know it's from a dmg. Also has a convenient flag to tell you if the
volume is writeable.
You may also be able to bypass hdiutil entirely and use the DiskImages
framework to get the info you need, but I don't know any specifics of
how to do it off the top of my head.
-Jim....
On 2/11/07, Dirk Stegemann (Mailing-Lists) <email@hidden> wrote:
Hello Brad,
you could use the hdiutil tool to try to unmount the volume your
running application resides on. The unmount process itself should
fail, though, but the error differs for different situations.
E.g. failing to umount a disk image your app is running from contains
the error code "49153".
Failing to umount a network share will result in "no such file or
folder".
hdiutil detach /Volumes/TheVolumeYourAppResidesOn/
The exact error message might differ between system versions,
especially as these error messages posted by hdiutil are localized
(unfortunately). So you will have to experiment a bit and parse
hdiutil's output.
Also, the hdiutil man page (<x-man-page://hdiutil>) states that using
the "/Volumes/yourvolumename/" path to unmount a disk image does work
for Mac OS X 10.4 systems only – the Mac OS X 10.3 version of hdiutil
expects the device path (e.g. "/dev/disk1s2").
Run "hdiutil attach /path/to/your/diskimage" to see your mounted disk
image's device path. I do not know the tool(s) used to get the device
path for a certain mounted volume...
hth
Best regards,
Dirk Stegemann
Am 11.02.2007 um 16:53 schrieb Brad Peterson:
> Hi all,
>
> I know there's a way for an app to determine if it's
> running from a mounted removable volume (just get the
> path, see if it's in the NSWorkspace
> mountedRemovableMedia list).
>
> However, I'd like to be more specific than that and
> determine whether I'm running from a mounted DMG. The
> DMG could be writable, so the usual checks for, say, a
> CD don't apply here.
>
> Any thoughts?
>
> Thanks!
>
> B
>
>
>
>
> ______________________________________________________________________
> ______________
> Need Mail bonding?
> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
> http://answers.yahoo.com/dir/?link=list&sid=396546091
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> email@hidden
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden