Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ames!ucbcad!ucbvax!hplabs!decwrl!labrea!rocky!ali From: ali@rocky.STANFORD.EDU (Ali Ozer) Newsgroups: comp.sys.amiga Subject: Re: How to cd Message-ID: <810@rocky.STANFORD.EDU> Date: Tue, 8-Dec-87 15:55:43 EST Article-I.D.: rocky.810 Posted: Tue Dec 8 15:55:43 1987 Date-Received: Sun, 13-Dec-87 16:14:41 EST References: <796@rocky.STANFORD.EDU> <1237@sugar.UUCP> Reply-To: ali@rocky.UUCP (Ali Ozer) Organization: Stanford University Computer Science Department Lines: 36 In article <1237@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes: >In article <796@rocky.STANFORD.EDU>, I wrote: >> What's the correct way to change directories in a program without going >> back to the original directory at the end? > >You UnLock() any lock *you* obtain (==Lock()). Your original directory wasn't >Lock()ed by you, so you better not UnLock it. Otherwise either CLI will be >trying to work without a valid lock (accessed next time you do a dir), or >Workbench will be UnLocking an UnLocked lock, or maybe even using it! >When you do a CurrentDir(), you also need to keep that lock around as long >as you're in that directory. When you finish, CurrentDir() back to your >original directory's lock (returned from CurrentDir()). THEN you can trash >the new lock. You doing that? I'm not, because I do not want to connect back to my old directory! I got one message indicating that it seems to be OK to do an UnLock() on my ORIGINAL directory --- the one returned by CurrentDir(). In short: destdir = Lock ("whatever the new directory is", ACCESS_READ); UnLock (CurrentDir (destdir)); /*Error conditions, checks, etc, deleted for brevity*/ seems to work, but looks evil, goes against everything I've read and everything my parents told me. If I try to do what I've read, and I UnLock(destdir), well, the machine hangs on the first DOS operation after I quit --- mainly because I'm connected to a directory I have no lock on... So, the question is: Is the above OK for purposes of duplicating the functionality of "cd"? Ali ps. Oh, totally off the wall comment: Just yesterday I saw Amiga World on the news stands at Payless, right between MacWorld and two PC magazines. For the first time! They also had a few other computer magazines --- One for the C64, and for the Apple II.