home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!kth.se!dront.nada.kth.se!d88-jwa
- From: d88-jwa@dront.nada.kth.se (Jon Wtte)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Questions about referring to files
- Message-ID: <1993Jan8.172627.28808@kth.se>
- Date: 8 Jan 93 17:26:27 GMT
- References: <C0IIvs.8L2@news.udel.edu>
- Sender: usenet@kth.se (Usenet)
- Organization: Royal Institute of Technology, Stockholm, Sweden
- Lines: 72
- Nntp-Posting-Host: dront.nada.kth.se
-
- In <C0IIvs.8L2@news.udel.edu> kurisuto@chopin.udel.edu (Sean J. Crist) writes:
-
- >My problem is this: I've read the file manager chapters in IM I, IV, and
- >VI thoroughly, and I'm in the dark about which paradigm I should use to refer
- >to my files. I want to support System 6.0.4 and higher; if I am not
- >mistaken, this means I can't use the FSSpec designation from System 7. I
- >would have thought that a filename and vRefNum would be good enough, but I
-
- No, you unfortunately can't, unless you write wrappers around
- the FSp calls that do the right thing on pre-7 systems.
-
- >recently saw a posting here on c.s.m.p. which I understood to say that
- >this way of designating files went out of fashion with System 3.2.
- >(I'm currently using OpenRFPerm to open my resource files, which seems to
- >be working fairly well.)
-
- You should be using HOpenResFile. The HXXX calls are all available
- from system 3.2 and up, except for HOpenDF. Instead, use HOpen
- preceded by a HGetFInfo to see it's not a driver.
-
- MPW 3.2 and Think 5.0 provides glue for these calls.
-
- >Second question: System 6.x and System 7.x organize the System
- >Folder differently (well, System 6.x doesn't organize it at all :-). Is
- >the correct way to handle temporary files to use Gestalt to see whether
- >the Temporary Items folder of System 7.x is available, and to store into
- >the main System Folder if not? If anyone has or knows of some source code
-
- Actually, FindFolder has glue that's almost as smart as the
- Gestalt glue; if you call FindFolder under system 6, I think
- you get the System Folder for most folders. And remember,
- even under SYstem 7 you're not GUARANTEED a temp folder, you
- could have a locked volume for instance.
-
- >I'm also not certain how to move my temporary file out of the appropriate
- >directory into the one chosen by the user with SFPutFile. If it's on
- >another volume I'll obviously have to copy it myself. I believe System 7
-
- Try nothaving it on another volume, unless that's a slow volume...
-
- >has some way of easily moving files within one volume, but does System 6?
- >(If it's something too complicated, I'll just make a copy of the file and then
- >delete the original, briefly wasting a small amount of disk space.)
-
- Under System 7, use FSpExchangeFiles. This call is just too coool
- for words. Under System 6, you can do something close with a little
- re-naming and judicious use of CatMove (on the same volume)
-
- As you said, cross volumes you have to copy the file.
-
- >One last thing: my application doesn't support Apple Events yet, but I
- >plan to add such support. Does this constrain me to using a particular
- >file designation scheme, or can I just convert between FSSpec and an older
- >scheme as I need? (Also, is there sample code anywhere illustrating how
- >to handle the core Apple events?)
-
- Inside Mac VI gives sample code for the core events. Remember to
- call AEInteractWithUser if you want to put up a dialog or something.
- However, writing a program that supports both System 6 and Apple Events
- is a little tricky (though not much)
-
- You'll ask for FSSpecs from the AE Manager, however, you can just
- peek into the structure top get the cRefNum, parID and name used by
- the HXXX calls.
-
- Cheers,
-
- / h+
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
-
- There's no sex act that can't be made better with Yell-O.
-