Xref: utzoo comp.sys.amiga:14780 comp.sys.misc:1207 Path: utzoo!mnetor!uunet!cbmvax!andy From: andy@cbmvax.UUCP (Andy Finkel) Newsgroups: comp.sys.amiga,comp.sys.misc Subject: Re: Cleaner PopCLI path(?) Message-ID: <3349@cbmvax.UUCP> Date: 22 Feb 88 16:49:03 GMT References: <10373@ut-sally.UUCP> <1943@cadovax.UUCP> Reply-To: andy@cbmvax.UUCP (Andy Finkel) Organization: Commodore Technology, West Chester, PA Lines: 70 In article <1943@cadovax.UUCP> keithd@cadovax.UUCP (Keith Doyle) writes: >In article <10373@ut-sally.UUCP> bryan@mothra.cs.utexas.edu writes: >> >> Funny how it just takes years to notice some things. Although I've had >>my hard disk for a while now and my command search path has grown accordingly, >>I only recently noticed that the CLI launched by popCLI doesn't inherit the >>'right' path information. > >We just ran into a related problem recently. > >Try this: > >main() >{ > Execute("cd",0L,0L); >} > >No matter where you run this program from, the result is *always* DF0:. >Even if everything has been reassigned elsewhere and there is not even >a disk in drive 0. > >We wondered where it was getting the DF0: from, and found that it is >hard coded in the CD program. It is also hard coded in the Assign program >and probably a few others. > Right problem, wrong answer. The hardcoded DF0: in CD is to deal with the situation that happens before you CD anywhere, before you have a lock on anything, ie when you've just booted. Now, the answer: Execute (which calls on the RUN program) gives you a shiny new Process to play in. This means it has no idea of where you're CD'd to. >As far as I know, there is no way to get an Executed command to use >the current programs current directory as its current directory. Or >anything but DF0: for that matter. What I generally do it one of the following, depending on what I'm doing: a) before I call Execute I make a temporary Assign to where my application program lives, and use that in the command. b) If I'm running a script file I build a CD command to my current location, and feed my script file to Execute via the input handle, while Executing the CD command c) And, you can use the + option of run to string commands together, even in an Execute statement, ie Execute("run cd+\ncd df0:l+\ncd",0,0) fine. BTW, I did try it with Execute() inheriting some things from the starting process...a lot of programs broke. The solution it to have a new, more elaborate Execute call for V1.4, I guess. -- andy finkel {ihnp4|seismo|allegra}!cbmvax!andy Commodore-Amiga, Inc. "Never test for an error condition you don't know how to handle." Any expressed opinions are mine; but feel free to share. I disclaim all responsibilities, all shapes, all sizes, all colors.