[Sparkle] Invoking hdiutil
Justin Bur
jbur at druide.com
Wed Aug 1 08:57:31 PDT 2007
On Aug 1, 2007 at 9:03, Ashley Moran wrote:
> On 1 Aug 2007, at 04:29, Dave Dribin wrote:
>
>> Hmmm... is there a good reason that Sparkle should not hardcode the
>> path to hdiutil? I'm thinking this would solve PATH problems like
>> this. A user could install a non-Apple compatible program called
>> "hdiutil" in their path and break Sparkle, too. This somehow seems
>> wrong. I can't see Apple moving it out of /usr/bin.
>
> Could you make it try with env first, and if it fails, retry with /
> usr/bin/hdiutil? But that might be too much work for no gain - I
> also can't see why it would be moved out of /usr/bin either. It's
> not needed in single user mode so it won't end up in /bin, and I
> doubt very much it would ever be considered an sbin
Yes, the path could and probably should be hard-coded.
What's the point of using env at all? Env is useful when you want to
alter the environment before running a command. Env with no arguments
is a no-op.
This is what I use in my own Sparkle source:
// First, we internet-enable the volume.
NSTask *hdiTask = [NSTask launchedTaskWithLaunchPath:@"/usr/
bin/hdiutil" arguments:[NSArray arrayWithObjects:@"internet-enable",
@"-quiet", archivePath, nil]];
[hdiTask waitUntilExit];
if ([hdiTask terminationStatus] != 0) { return NO; }
// Now, open the volume; it'll extract into its own directory.
hdiTask = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/
hdiutil" arguments:[NSArray arrayWithObjects:@"attach", @"-idme", @"-
noidmereveal", @"-noidmetrash", @"-noverify", @"-nobrowse", @"-
noautoopen", @"-quiet", archivePath, nil]];
[hdiTask waitUntilExit];
if ([hdiTask terminationStatus] != 0) { return NO; }
Justin
More information about the Sparkle
mailing list