home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 21006 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  3.8 KB

  1. 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
  2. From: d88-jwa@dront.nada.kth.se (Jon Wtte)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Questions about referring to files
  5. Message-ID: <1993Jan8.172627.28808@kth.se>
  6. Date: 8 Jan 93 17:26:27 GMT
  7. References: <C0IIvs.8L2@news.udel.edu>
  8. Sender: usenet@kth.se (Usenet)
  9. Organization: Royal Institute of Technology, Stockholm, Sweden
  10. Lines: 72
  11. Nntp-Posting-Host: dront.nada.kth.se
  12.  
  13. In <C0IIvs.8L2@news.udel.edu> kurisuto@chopin.udel.edu (Sean J. Crist) writes:
  14.  
  15. >My problem is this:  I've read the file manager chapters in IM I, IV, and
  16. >VI thoroughly, and I'm in the dark about which paradigm I should use to refer
  17. >to my files.  I want to support System 6.0.4 and higher; if I am not
  18. >mistaken, this means I can't use the FSSpec designation from System 7.  I
  19. >would have thought that a filename and vRefNum would be good enough, but I
  20.  
  21. No, you unfortunately can't, unless you write wrappers around
  22. the FSp calls that do the right thing on pre-7 systems.
  23.  
  24. >recently saw a posting here on c.s.m.p. which I understood to say that
  25. >this way of designating files went out of fashion with System 3.2.
  26. >(I'm currently using OpenRFPerm to open my resource files, which seems to
  27. >be working fairly well.)
  28.  
  29. You should be using HOpenResFile. The HXXX calls are all available
  30. from system 3.2 and up, except for HOpenDF. Instead, use HOpen
  31. preceded by a HGetFInfo to see it's not a driver.
  32.  
  33. MPW 3.2 and Think 5.0 provides glue for these calls.
  34.  
  35. >Second question:  System 6.x and System 7.x organize the System
  36. >Folder differently (well, System 6.x doesn't organize it at all :-).  Is
  37. >the correct way to handle temporary files to use Gestalt to see whether
  38. >the Temporary Items folder of System 7.x is available, and to store into
  39. >the main System Folder if not?  If anyone has or knows of some source code
  40.  
  41. Actually, FindFolder has glue that's almost as smart as the
  42. Gestalt glue; if you call FindFolder under system 6, I think
  43. you get the System Folder for most folders. And remember,
  44. even under SYstem 7 you're not GUARANTEED a temp folder, you
  45. could have a locked volume for instance.
  46.  
  47. >I'm also not certain how to move my temporary file out of the appropriate
  48. >directory into the one chosen by the user with SFPutFile.  If it's on
  49. >another volume I'll obviously have to copy it myself.  I believe System 7
  50.  
  51. Try nothaving it on another volume, unless that's a slow volume...
  52.  
  53. >has some way of easily moving files within one volume, but does System 6?
  54. >(If it's something too complicated, I'll just make a copy of the file and then
  55. >delete the original, briefly wasting a small amount of disk space.)
  56.  
  57. Under System 7, use FSpExchangeFiles. This call is just too coool
  58. for words. Under System 6, you can do something close with a little
  59. re-naming and judicious use of CatMove (on the same volume)
  60.  
  61. As you said, cross volumes you have to copy the file.
  62.  
  63. >One last thing:  my application doesn't support Apple Events yet, but I
  64. >plan to add such support.  Does this constrain me to using a particular
  65. >file designation scheme, or can I just convert between FSSpec and an older
  66. >scheme as I need?  (Also, is there sample code anywhere illustrating how
  67. >to handle the core Apple events?)
  68.  
  69. Inside Mac VI gives sample code for the core events. Remember to
  70. call AEInteractWithUser if you want to put up a dialog or something.
  71. However, writing a program that supports both System 6 and Apple Events
  72. is a little tricky (though not much)
  73.  
  74. You'll ask for FSSpecs from the AE Manager, however, you can just
  75. peek into the structure top get the cRefNum, parID and name used by
  76. the HXXX calls.
  77.  
  78. Cheers,
  79.  
  80.                     / h+
  81. -- 
  82.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  83.  
  84.    There's no sex act that can't be made better with Yell-O.
  85.