Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > path to CL app

path to CL app
Thread Tools
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Sep 25, 2002, 08:35 AM
 
I can get the "command" of an active process using `ps'

But I'd like to know if there is a Obj-C method something like "pathTo: activeProcess". I'm not too exited about using NSTask and `ps' because what if the path has "space" character, it's not very nice way of getting the path [because the arguments are there also...]
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 27, 2002, 05:01 PM
 
You could always use sysctl (man 3 sysctl)
     
Junior Member
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 27, 2002, 05:37 PM
 
There is a method in the NSWorkspace class that returns information about active apps. Including the path.

Code:
[[NSWorkspace sharedWorkspace] launchedApplications];


it returns an NSArray of Dictionaries for all the open apps. Hope that helps.

type R 503
I be that insane n***a from the psycho ward.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 28, 2002, 03:48 PM
 
That only works for GUI applications which have established a connection to the windowserver. For apps which are still launching, or for CLI apps (which is what VEGAN wants, according to this thread title), you'll have to use something lower-level.
     
VEGAN  (op)
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Sep 28, 2002, 04:14 PM
 
Originally posted by type_r503:
There is a method in the NSWorkspace class that returns information about active apps. Including the path.

Code:
[[NSWorkspace sharedWorkspace] launchedApplications];


it returns an NSArray of Dictionaries for all the open apps. Hope that helps.

type R 503
No go.
I know about this but it's not for CLI applications.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:50 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2