OK, Chris; here's an example of what I'm trying to do.My program has two menu items, call them "File..." and "File Again". If the user chooses the former, he gets a window/panel allowing him to select the file the app works on. If he chooses the latter, the app works on the last file he selected. So, in the former case, I save the file path string in [NSUserDefaults standardUserDefaults], with key @"inFilePath", say. In the latter case, I retrieve the file path string in [NSUserDefaults standardUserDefaults].
So the set of user defaults must persist between one invocation of the app to another, presumably stored in some file, somewhere. That file doesn't appear to be the project's Info.plist, because there's no occurrence of the string "inFilePath" there.
So where is it stashed? And do I have to do something to stash it (and retrieve it when my app begins execution), or does that happen automatically?
Although reading "User Defaults Programming Topics" should enlighten me, I'm unable to form a mental picture of what's going on from reading it. --------------------------------------------------------------- On Apr 30, 2007, at 11:34 AM, Chris Hanson wrote: On Apr 30, 2007, at 8:44 AM, Roland Silver wrote: Starting from a project's xcodeproj file, how do I get to the place in the project itself where the plist is specified (the plist, that is, where I stash my own preferences)? For instance, for my project called "markovx", I'd expect there to be a path <~/Library/Preferences/com.yourcompany.markovx.plist> (but there isn't), and for there to be -- SOMEWHERE WITHIN THE PROJECT ITSELF -- a specification of that path.
My question is, how do I get to see that path specification?
What is it that you're really trying to accomplish? It sounds like you're going about it in an overly-complex route. If you tell us what it is that you're actually trying to do, there may be a straightforward way to do it that you may not have considered.
There is no such path ever specified anywhere. The path is generated at runtime by the underlying frameworks that implement the preferences mechanism. It's typically generated from an application's bundle identifier, though there are ways you can request that the APIs use a different identifier. Also, when you say "the plist" and you're talking about an application, it's generally expects that you're talking about its Info.plist file, not its user defaults (preferences) database.
An application's bundle identifier is specified in its Info.plist. At build time, the target that builds that application has a build setting that Xcode's build system uses to find a "prototype" Info.plist file. Xcode's build system processes this file, potentially running the C preprocessor on it and also performing build setting substitution, and makes the result of this processing the built application's Info.plist.
Note that because the location of the prototype Info.plist file is specified by a build setting, it may not be specified or completely specified by the target itself. It might be inherited from the project that contains the target, it might be specified in an xcconfig file, it might be the result of evaluating other build settings, and so on. If a target does not directly specify its Info.plist file, the only way to have perfect knowledge of what file the Xcode build system will use is to be the Xcode build system.
-- Chris
|