• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: exec(uting) Safari - How (newbie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exec(uting) Safari - How (newbie)


  • Subject: Re: exec(uting) Safari - How (newbie)
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Wed, 2 Jul 2008 09:30:29 +0200

"a lot easier than Launch Services" ?

extern char **environ;
char *args[] = { "-a", "Safari", NULL};
execve("/usr/bin/open", args, environ);

versus:

FSRef app;
if (noErr == LSFindApplicationForInfo(kLSUnknownCreator, NULL, CFSTR("Safari"), &app, NULL))
LSOpenFSRef(&app, NULL);




Le 2 juil. 08 à 06:45, Jason Coco a écrit :

What env pollution? I agree that exec* isn't really the way to go, but that's what the OP was using... I just suggested that /usr/bin/ open is a better option than hard-coding the path to some arbitrary application. It's also a lot easier to use than the LaunchServices API... although if I were gonna use it, I'd definitely do so from an NSTask object as others have already suggested.

On Jul 1, 2008, at 23:44 , Kyle Sluder wrote:

On Tue, Jul 1, 2008 at 8:17 PM, Kevin Elliott <email@hidden> wrote:
Of course, they're both bad choices. As several people have pointed out,
NSWorkspace launchApplication or openURL depending on the requirements. If
it's not possible to use NSWorkspace (i.e. because you can't link against
AppKit) consider NSTask or using LaunchServices. But unless you have a
SPECIFIC, low level requirement exec is the wrong API.

I was even more concerned about the env pollution necessary for exec
to work as described ("not needing to know where Safari lives"). exec
is just a bad idea all around for anything outside of the BSD
environment.


--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

  • Follow-Ups:
    • Re: exec(uting) Safari - How (newbie)
      • From: Jason Coco <email@hidden>
References: 
 >exec(uting) Safari - How (newbie) (From: "Barrie Green" <email@hidden>)
 >Re: exec(uting) Safari - How (newbie) (From: Kristopher Matthews <email@hidden>)
 >Re: exec(uting) Safari - How (newbie) (From: Jason Coco <email@hidden>)
 >Re: exec(uting) Safari - How (newbie) (From: "Kyle Sluder" <email@hidden>)
 >Re: exec(uting) Safari - How (newbie) (From: Kevin Elliott <email@hidden>)
 >Re: exec(uting) Safari - How (newbie) (From: "Kyle Sluder" <email@hidden>)
 >Re: exec(uting) Safari - How (newbie) (From: Jason Coco <email@hidden>)

  • Prev by Date: Re: Getting mouse moved events on overlay windows
  • Next by Date: Disabling column selection NSTableView
  • Previous by thread: Re: exec(uting) Safari - How (newbie)
  • Next by thread: Re: exec(uting) Safari - How (newbie)
  • Index(es):
    • Date
    • Thread