home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17256 < prev    next >
Encoding:
Internet Message Format  |  1992-12-12  |  1.6 KB

  1. Path: sparky!uunet!cbmvax!jesup
  2. From: jesup@cbmvax.commodore.com (Randell Jesup)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Detecting root directories
  5. Message-ID: <37819@cbmvax.commodore.com>
  6. Date: 11 Dec 92 22:20:19 GMT
  7. References: <1g5q65INN97p@cs.tut.fi> <1992Dec9.225928.17421@jato.jpl.nasa.gov> <1992Dec10.021818.20474@sparky.imd.sterling.com>
  8. Reply-To: jesup@cbmvax.commodore.com (Randell Jesup)
  9. Organization: Commodore, West Chester, PA
  10. Lines: 26
  11.  
  12. rick@IMD.Sterling.COM (Richard Ohnemus) writes:
  13. >>>How can I detect if a Locked directory is a root directory
  14.  
  15. >>Pass the device part to GetDeviceProc and if the dvp_Lock field is zero, 
  16. >>the name refers to a root directory. Don't forget FreeDeviceProc after-
  17. >>wards. Under 1.3 use DeviceProc/IoErr.
  18.  
  19.     "device part"?  He has a lock, not a path.  He'd have to call 
  20. NameFromLock() to get a path (which walks to the root using ParentDir)!
  21.  
  22. >    parent = ParentDir(lock);            /* 0 if lock is root of filing system */
  23. >    if (!(root = parent == (BPTR) NULL))
  24. >        UnLock(parent);                  /* release parent lock */
  25. >
  26. >This should work on all versions of AmigaDos >= 1.0 (At least I think it does.
  27.  
  28.     I prefer the ParentDir() approach.  No version checks needed, and it's
  29. also lower overhead, even if you start with a string.  This is how NameFromLock
  30. finds the root.
  31.  
  32. -- 
  33. To be or not to be = 0xff
  34. -
  35. Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
  36. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
  37. Disclaimer: Nothing I say is anything other than my personal opinion.
  38.