Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting path to executing application



That's what I thought.

I've got a cross-platform library that I don't want to make dependent on a nib having to exist that sits at a certain place in it's own file hierarchy.

All of the legit solutions to this problem just make my lib more difficult to use. Now the user will need to call an init method with arg params before doing anything else. annoying.

Thanks guys.

On Friday, July 25, 2003, at 12:28PM, Sailor Quasar wrote:

On Friday, July 25, 2003, at 12:38 PM, Matt Watson wrote:
I'm needing to find a way to get the path to where the actual executable file resides using POSIX apis.
[...]
I don't want to have to construct it from argv[0] with the cwd.

after looking around, I'm beginning to think that this isn't possible.
This isn't possible, given your constraints.

The full path of the running process, using only POSIX APIs, not using argv[0], and not peeking into kernel mem (which is what lsof and ps do)? That falls under the same missing-functionality heading as the inability to determine the file path/name from an open file descriptor...

The theory was that you shouldn't need to determine your own current path, since you could run another copy of yourself using a fork()/main()/_exit() construct and the working directory ought to be determined by the enclosing shell (or GUI layer). Also, that you shouldn't need to know the filename from an open descriptor since you needed that information to create it to begin with.

Both of those chains of reasoning break miserably on OS X, of course. The theory of application packages requires you to be able to track your own location, and of course you need to determine filenames from open file handles because they can be passed to you from all sorts of places. One also notes that OS X provides both of these functionalities using CF/NSBundle and the modern Carbon File Manager.

-- Sailor Quasar, just another player in The World
"Come with me in the twilight of the summer night for awhile"
Email: email@hidden


-------------------
Tobias Ford...
email@hidden email@hidden
-------------------
Senior Software Engineer @ WolfPack Studios
www.wolfpackstudios.com www.shadowbane.com
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.