gft_robert@gsbacd.uchicago.edu (05/03/90)
An app I'm doing for a client requires for two types of files to be open before it will work. Originally I got the files by doing it the "THINK" way (that is, just asking the user on startup to show me where the files are). The client isn't too keen on that, though, and would prefer that default files be used. How do you do this? I could just search for a default file name which was hard-coded into the program, and ask if I can't locate that file. The client thought a better idea would be to save in a resource the names of the two files most recently used, and then ask if those can't be found. Since one is not supposed to write to the resource fork of the app itself, this would require yet a third file in which to maintain these resources, right? But then I have to ask the user to find that file if it can't be found, or if the names been changed, right? Or am I making this more complicated than it need be? Any info much appreciated! Robert ============================================================================ = gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to = = * all my opinions are * compute" = = * mine * -Kraftwerk = ============================================================================
d88-jwa@nada.kth.se (Jon W{tte) (05/03/90)
In article <9087@tank.uchicago.edu>, gft_robert@gsbacd.uchicago.edu writes: > How do you do this? I could just search for a default file name which was > hard-coded into the program, and ask if I can't locate that file. The client > thought a better idea would be to save in a resource the names of the two files > most recently used, and then ask if those can't be found. Since one is not > supposed to write to the resource fork of the app itself, this would require > yet a third file in which to maintain these resources, right? But then I have The standard way to do this is: Have a resource struct that contains dirId and name of the files. Save this resource in a "Preferences file" in the SYSTEM FOLDER. The volRefNum of the system folder is available through SysEnvirons() so you should have no problem saving it there. If you want to get funky, do this: Check for the system folder. Check for a folder named "Preferences" in the system folder. If there is no such folder, create it and create your empty "prefs" file. Otherwise, check in that folder for your "prefs" file. If there is none, create it, in the "Preferences" folder. If everydbody sis this, we would soon not have the cluttered system folders we now have. / h+ --- Stay alert ! - Trust no one ! - Keep your laser handy ! --- h+@nada.kth.se == h+@proxxi.se == Jon Watte longer .sig available on request
kaufman@Neon.Stanford.EDU (Marc T. Kaufman) (05/04/90)
In article <1990May3.112707.4287@kth.se> d88-jwa@nada.kth.se (Jon W{tte) writes:
-Check for the system folder.
-Check for a folder named "Preferences" in the system folder.
-If there is no such folder, create it and create your empty "prefs" file.
-Otherwise, check in that folder for your "prefs" file.
-If there is none, create it, in the "Preferences" folder.
Would someone like to suggest a canonical STR resource number containing the
name 'Preferences' ?
Marc Kaufman (kaufman@Neon.stanford.edu)
gft_robert@gsbacd.uchicago.edu (05/04/90)
In article <1990May3.173308.646@Neon.Stanford.EDU>, kaufman@Neon.Stanford.EDU (Marc T. Kaufman) writes... >In article <1990May3.112707.4287@kth.se> d88-jwa@nada.kth.se (Jon W{tte) writes: > >-Check for the system folder. >-Check for a folder named "Preferences" in the system folder. >-If there is no such folder, create it and create your empty "prefs" file. >-Otherwise, check in that folder for your "prefs" file. >-If there is none, create it, in the "Preferences" folder. > >Would someone like to suggest a canonical STR resource number containing the >name 'Preferences' ? Thanks for the info folks! BTW, Larry Rosenstein (Apple Object Specialist) sent me a note regarding my problem, and in it he mentioned that System 7 will have a Preferences folder and a Folder Manager which will enable you to find it. Just thought I'd let you know before you re-write part of System 7. :-> Robert ============================================================================ = gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to = = * all my opinions are * compute" = = * mine * -Kraftwerk = ============================================================================
chewy@apple.com (Paul Snively) (05/05/90)
In article <9119@tank.uchicago.edu> gft_robert@gsbacd.uchicago.edu writes: > Thanks for the info folks! BTW, Larry Rosenstein (Apple Object Specialist) > sent me a note regarding my problem, and in it he mentioned that System 7 will > have a Preferences folder and a Folder Manager which will enable you to find > it. Just thought I'd let you know before you re-write part of System 7. :-> > > Robert Although if you want your code to run under both System 6.x and System 7.x, you'll still wind up re-writing part of System 7.x. [sigh] > ========================================================================= === > = gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to = > = * all my opinions are * compute" = > = * mine * -Kraftwerk = > ========================================================================= === __________________________________________________________________________ Paul Snively Macintosh Developer Technical Support Apple Computer, Inc. 1st Choice: Paul_Snively.DTS@gateway.qm.apple.com 2nd Choice: CHEWBACCA@applelink.apple.com Last Choice: chewy@apple.com Just because I work for Apple Computer, Inc. doesn't mean that I believe what they believe, or vice-versa. __________________________________________________________________________
d88-jwa@nada.kth.se (Jon W{tte) (05/07/90)
In article <1990May3.173308.646@Neon.Stanford.EDU>, kaufman@Neon.Stanford.EDU (Marc T. Kaufman) writes: [ I write ] > -Check for a folder named "Preferences" in the system folder. > Would someone like to suggest a canonical STR resource number containing the > name 'Preferences' ? I really think this isn't necessary - most users don't look in the system folder, and since the applications that presently exist and use the folder trick (United does, how many else ?) have the name "Preferences" hard-coded, there's no need for every application to create it's own folder in the system folder... I usually bitch about "foreign awareness" but I really don't find this case to be worth it. Consider; the Finder is called Finder, MF is called MultiFinder even in Sweden. But if you like to, you can always have STR Id 4711, name "Preferences Folder Name", as your standard :-) > Marc Kaufman (kaufman@Neon.stanford.edu) h+ --- Stay alert ! - Trust no one ! - Keep your laser handy ! --- h+@nada.kth.se == h+@proxxi.se == Jon Watte longer .sig available on request