[Coco] Get the current work path

Wayne Campbell asa.rand at gmail.com
Wed Feb 14 22:50:51 EST 2018


As I said, I can find no system call to use for this. I wrote a sample
program using the method Curtis outlined. Here it is:

DIM path:BYTE
DIM tempFile:STRING[29]
DIM pwd:STRING[80]

SHELL "ex pwd > temp"
tempFile:="temp"
OPEN #path, tempFile:READ
READ #path, pwd
CLOSE #path
DELETE tempFile
PRINT pwd

This should give you a way to get the current directory.


On Wed, Feb 14, 2018 at 7:45 PM, phil pt <ptaylor2446 at gmail.com> wrote:

> Maybe using syscall?
>
> On Wed, Feb 14, 2018 at 10:43 PM, Wayne Campbell <asa.rand at gmail.com>
> wrote:
>
> > I think you're right Curtis. There is no system call I can find for
> > returning current working or execution directory. SHELL "ex pwd" and
> SHELL
> > "ex pxd" work in Basic09, but only return the path to stdout and trying
> to
> > put the output into a variable results in an error. Your method is
> probably
> > the one to use, though it requires extra code.
> >
> > On Wed, Feb 14, 2018 at 7:37 PM, L. Curtis Boyle <
> curtisboyle at sasktel.net>
> > wrote:
> >
> > > I don’t think you can do it quite that easily. Are you running stock
> > > OS9/shell, or Nitros9/shellplus?
> > > What you may have to do is SHELL “PWD >-tempfile”
> > > Then open tempfile, read a line (which will have your path), close it,
> > and
> > > then delete tempfile.
> > > (shellplus supports the '>-‘ to overwrite an existing file. If using
> > > standard shell, you will likely have to do an ON ERROR GOTO and try
> > opening
> > > it first, and closing/deleting it if it opens without an error).
> > >
> > >
> > > L. Curtis Boyle
> > > curtisboyle at sasktel.net
> > >
> > >
> > >
> > > > On Feb 14, 2018, at 9:22 PM, phil pt <ptaylor2446 at gmail.com> wrote:
> > > >
> > > > Thanks
> > > >
> > > >
> > > >
> > > > On Wed, Feb 14, 2018 at 10:20 PM, Wayne Campbell <asa.rand at gmail.com
> >
> > > wrote:
> > > >
> > > >> Are you typing that at the command prompt for OS 9? In basic 09, it
> > has
> > > to
> > > >> be a statement in a source code file compiled in the basic 09 editor
> > and
> > > >> one from there if it is still giving you an error then check to make
> > > sure
> > > >> that ex pwd is in quotes. I have to get my computer and Boot It Up
> to
> > > run a
> > > >> test and give you some actual code give me a little time and I will
> > post
> > > >> back here with what I figure out.
> > > >>
> > > >> On Feb 14, 2018 7:05 PM, "phil pt" <ptaylor2446 at gmail.com> wrote:
> > > >>
> > > >>> I did that var$:=SHELL "ex pwd"  and I got a error
> > > >>>
> > > >>> On Wed, Feb 14, 2018 at 10:04 PM, Wayne Campbell <
> asa.rand at gmail.com
> > >
> > > >>> wrote:
> > >
> > >
> > > --
> > > Coco mailing list
> > > Coco at maltedmedia.com
> > > https://pairlist5.pair.net/mailman/listinfo/coco
> > >
> >
> >
> >
> > --
> > Wayne
> >
> > The Structure of I-Code
> > http://www.cocopedia.com/wiki/index.php/The_Structure_of_I-Code
> >
> > decode
> > http://cococoding.com/wayne/
> >
> > --
> > Coco mailing list
> > Coco at maltedmedia.com
> > https://pairlist5.pair.net/mailman/listinfo/coco
> >
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>



-- 
Wayne

The Structure of I-Code
http://www.cocopedia.com/wiki/index.php/The_Structure_of_I-Code

decode
http://cococoding.com/wayne/


More information about the Coco mailing list