[comp.sys.atari.st.tech] What path was I executed from?

cummins@d.cs.okstate.edu (John Cummins) (06/18/91)

How can my program find the path it was executed from if it's not
executed from the current directory?

for example:
  A BBS program (C:\bbs\bbs.tos) calls a door program
(C:\bbs\doors\door1\door1.tos).  I want the door program to be able to find
it's related datafiles (located in the same directory as the door1.tos file)
w/o resorting to having the user write a text file with the path in it, and
putting it in the current directory (such as C:\bbs\door1.pat containing
the path where the data files are to be found).

Seems to me this is somewhat like opening a window to a program/.rsc file,
then opening a second window, executing the program in the un-topped window
by ... holding down the right mouse button and then double clicking.
Ordinarily... any support files in the same directory as the program won't
be found.  What's the proper way to "fix" this.  As I would like the
Door software to be trivial to install.

jc
cummins@d.cs.okstate.edu

micro@imada.ou.dk (Klaus Pedersen) (06/20/91)

cummins@d.cs.okstate.edu (John Cummins) writes:
>How can my program find the path it was executed from if it's not
>executed from the current directory?

If it is a GEM program, you can use shel_read(), to get the full path, -
at least in TOS>=1.4.

>for example:
>  A BBS program (C:\bbs\bbs.tos) calls a door program
>(C:\bbs\doors\door1\door1.tos).  I want the door program to be able to find
>it's related datafiles (located in the same directory as the door1.tos file)

Again if the program is a GEM program, and it was started with shel_write,
as from the desktop, you can use shel_find() to get the path of the files. 

>Seems to me this is somewhat like opening a window to a program/.rsc file,
>then opening a second window, executing the program in the un-topped window
>by ... holding down the right mouse button and then double clicking.

The .rsc file will be found, as well as other files, that shel_find() gives
you the path to...

Klaus (micro@imada.ou.dk)