On 9 Dec 2009, at 00:03, Laurent Daudelin wrote:

> Is there any way I can find what's the path of a given process running? A 
> background process, which cannot be retrieved in [[NSWorkspace 
> sharedWorkspace] launchedApplications]?

If we're talking about background processes, to get this kind of information 
you probably need to use sysctl() (or run "ps" in the background and parse its 
output), however I think you'll find that you can only get the contents of the 
argv[] array, which can be set to *anything* by your parent process.

Furthermore, there is no guarantee that the executable will not have moved to a 
different location on the drive, or been replaced by a new (and potentially 
different) executable.

You might be interested in this (which I found using Google just now)

  <http://www.nightproductions.net/dsprocessesinfo_m.html>

which is fine for displaying the information to the user, but I really wouldn't 
recommend using or relying on the pathname of your executable, or anyone else's 
for that matter.

Kind regards,

Alastair.

-- 
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to