Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pacbell!att-ih!alberta!myrias!sjl From: sjl@myrias.UUCP (Stuart Lomas) Newsgroups: comp.sys.amiga Subject: Re: Dangling Locks Message-ID: <574@myrias.UUCP> Date: 17 Mar 88 22:09:41 GMT References: <45448@sun.uucp> Organization: Myrias Research, Edmonton Lines: 27 Keywords: Locks, hanging icons etc In message <45448@sun.uucp> cmcmanis%pepper@Sun.COM (Chuck McManis) writes: > e) One way to get the current directory without changing it... > TmpLock = Lock("RAM:",ACCESS_READ); > MyDir = CurrentDir(TmpLock); > OriginalDir = DupLock(MyDir); > TmpLock = CurrentDir(MyDir); /* Replace it */ > UnLock(TmpLock); /* Unlock OriginalDir later */ > The other way to get the current directory without changing it ... > MyProc = FindTask(0L); > OriginalDir = DupLock(MyProc->pr_CurrentDir); Both of these methods seem rather more complicated than: currentDir := Lock("",AccessRead); (I write in Modula-2, but I believe this will work the same in C) Someone asked for an example of where the Amiga documentation is unclear. This is an example - it is not at all clear from the documentation that passing Lock the null string as a file name will get you the current directory. Stuart Lomas Myrias Research Corporation Edmonton, Alberta, Canada {ihnp4,ubc-vision,rutgers}!alberta!myrias!sjl Naturally, if anything above constitutes an opinion, I claim it.