| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
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.This isn't possible, given your constraints.
after looking around, I'm beginning to think that this isn't possible.
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
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.