Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!kth.se!news From: d88-jwa@nada.kth.se (Jon W{tte) Newsgroups: comp.sys.mac.programmer Subject: Re: How does one manage default files? Message-ID: <1990May3.112707.4287@kth.se> Date: 3 May 90 11:27:07 GMT References: <9087@tank.uchicago.edu> Sender: news@kth.se (News Administrator) Reply-To: d88-jwa@nada.kth.se (Jon W{tte) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 35 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