[comp.sys.amiga.tech] Access to the command path?

schaub@sugar.UUCP (Markus Schaub) (03/31/88)

Where can I find the current command path for a CLI instantiation?
It must be a list of locks somewhere. I just didn't find the root.
Any hints, ideas?

-- 
     //	Markus Schaub			| The Modula-2 People:
    //	M2Amiga Developer		| Interface Technologies Corp.
\\ //   uunet!nuchat!sugar!schaub	| 3336 Richmond Ave. Suite 323
 \X/    (713) 523-8422			| Houston, TX 77098

avery@puff.cs.wisc.edu (Aaron Avery) (04/01/88)

In article <1782@sugar.UUCP>, schaub@sugar.UUCP (Markus Schaub) writes:
> Where can I find the current command path for a CLI instantiation?
> It must be a list of locks somewhere. I just didn't find the root.
> Any hints, ideas?

From the AmigaMail issue with the 1.2 updates in it:

The path list is held as a BPTR in the CommandDir member of the
CommandLineInterface structure. Each element of the path list consists of:
    BPTR NextPath (BPTR to next list entry)
    BPTR PathLock (a lock on the directory)

The CommandLineInterface structure for a dos process can be found via the
BPTR pr_CLI element in its Process structure.

Aaron Avery (avery@puff.cs.wisc.edu)
	    ({seismo,caip,allegra,harvard,rutgers,ihnp4}!uwvax!puff!avery)

SLMYQ@USU.BITNET (04/06/88)

>> Where can I find the current command path for a CLI instantiation?
>> It must be a list of locks somewhere. I just didn't find the root.
>> Any hints, ideas?
>
>From the AmigaMail issue with the 1.2 updates in it:
>
>The path list is held as a BPTR in the CommandDir member of the
>CommandLineInterface structure. Each element of the path list consists of:
>    BPTR NextPath (BPTR to next list entry)
>    BPTR PathLock (a lock on the directory)
>
>The CommandLineInterface structure for a dos process can be found via the
>BPTR pr_CLI element in its Process structure.

Hmmm.  I never knew it was there, but I think I have an easier way to find
the path.  Just use ParentDir() to find parent locks, and Examine() to find
out their filenames.  You build your path string backwards in memory.  I've
got a routine to do this if you're interested, and you don't have to mess
with a single BPTR.

Also, yet a simpler way is to look at the SetName BSTR in the CLI structure.
Unfortunately, if you use my CD program that puts the path in the title bar -
I didn't know about this when I made it, so it doesn't update it.  That's
why if you do something like "Copy #?.c to ram:" using my CD and the BCPL
Copy command, it'll say things like "DF0:Foo.c" and "DF0:Bar.c", because
my CD program doesn't update the path string.  Maybe in the next version.
Anyway, basically, if you use this string, you depend on the CD program you're
using to update the SetName.

                                Bryan

        Bryan Ford                    //// A computer does what \\\\
Snail:  1790 East 1400 North         //// you tell it to do, not \\\\
        Logan, UT 84321          \\\X///  what you want it to do. \\\X///
Email:  SLMYQ@USU.BITNET          \XXX/ Murphy's Law Calendar 1986 \XXX/