home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15381 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  2.8 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!apple!NewsWatcher!user
  2. From: REEKES@applelink.apple.com (Jim Reekes)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: vrefNum from Path Name
  5. Message-ID: <REEKES-110992141418@90.10.20.67>
  6. Date: 11 Sep 92 21:16:25 GMT
  7. References: <47022@shamash.cdc.com> <Btwwt5.7Bv@taligent.com> <14960@borg.cs.unc.edu> <47148@shamash.cdc.com> <25rU03zf79dw00@amdahl.uts.amdahl.com>
  8. Sender: usenet@Apple.COM
  9. Followup-To: comp.sys.mac.programmer
  10. Distribution: usa
  11. Organization: Apple Computer, Inc.
  12. Lines: 50
  13.  
  14. In article <25rU03zf79dw00@amdahl.uts.amdahl.com>, jsp@uts.amdahl.com
  15. (James Preston) wrote:
  16. > paul@svl.cdc.com (Paul Kohlmiller) writes:
  17. > }lari@strauss.cs.unc.edu (Humayun Lari) writes:
  18. > }>In article <Btwwt5.7Bv@taligent.com> keith@taligent.com (Keith Rollin) writes:
  19. > } [says to always use FSMakeFSSpec and not create a FSSpec on your own.]
  20. > }>What about when the file/directory you're referring to does not exist?
  21. > }>If I remember correctly, FSMakeFSSpec checks to make sure that it does, so
  22. > }>it would return an error code when you're trying to create an FSSpec prior to
  23. > }>performing a Save As... Or am I wrong about this? Keith?
  24. > }My reading of IM6 seems to say that you will get an error but the
  25. > }FSSpec is still good. Haven't tried it.
  26. > }Other Opinions welcome.
  27. > I can vouch for this.  FSMakeFSSpec returns the file not found error, but
  28. > goes ahead and makes a valid FSSpec for the missing file (i.e. the vRefNum
  29. > and dirID fields reference the correct folder, and the name field contains
  30. > the name of the non-existant file).  A very handy feature.  But do remember
  31. > that FSSpecs are only found on System 7.
  32.  
  33. Folks, the answer can be found in the documentation.
  34.  
  35. Inside Mac, 2nd Ed. "Files" page 2-167
  36.  
  37. begin quote
  38.  
  39. "If the specified volume is mounted and the specified parent directory
  40. exists, but the target file or directory doesn't exist in that location,
  41. FSMaskFSSpec fills in the record and then returns fnfErr instead of noErr.
  42. The record is valid but it describes a target that doesn't exist.  You can
  43. use the record for other operations, such as creating a file with the
  44. FSpCreate function.
  45.  
  46. In addition to the result codes that follow, FSMakeSFSpec can return a
  47. number of other File Manager error codes.  If your application receives
  48. any result code other than noErr or fnfErr, all fields of the resulting
  49. FSSpec record are set to 0."
  50.  
  51. end quote
  52.  
  53. -----------------------------------------------------------------------
  54. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  55.                              |          Sound Manager Expert
  56. Apple Computer, Inc.         | RAll opinions expressed are mine, and do
  57. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  58. Cupertino, CA 95014          |       employer, Apple Computer Inc.S
  59.