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