Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!cornell!batcomputer!itsgw!imagine!pawl19.pawl.rpi.edu!jesup From: jesup@pawl19.pawl.rpi.edu (Randell E. Jesup) Newsgroups: comp.sys.amiga Subject: Re: How to cd Message-ID: <138@imagine.PAWL.RPI.EDU> Date: 10 Dec 87 09:25:56 GMT References: <796@rocky.STANFORD.EDU> <1237@sugar.UUCP> <810@rocky.STANFORD.EDU> Sender: news@imagine.PAWL.RPI.EDU Reply-To: lunge!jesup@beowulf.UUCP Organization: RPI Public Access Workstation Lab - Troy, NY Lines: 28 In article <810@rocky.STANFORD.EDU> ali@rocky.UUCP (Ali Ozer) writes: ... > 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"? Yes. In fact, the only way. I don't know WHO told you otherwise, but they were wrong. CurrentDir just replaces pr_currentdir with the lock you passed and returns you the old one. Note that the CD program also sets the cli_SetName field of the CLI structure. If you want to UnLock(destdir), do UnLock(CurrentDir(DupLock(destdir))). Then you can UnLock(destdir) :-) Another note: If your program is started from WB, you MUST save the original dir lock, and restore it before you exit, as WB remembers what things were set to, or some such. // Randell Jesup Lunge Software Development // Dedicated Amiga Programmer 13 Frear Ave, Troy, NY 12180 \\// lunge!jesup@beowulf.UUCP (518) 272-2942 \/ (uunet!steinmetz!beowulf!lunge!jesup)