[comp.sys.amiga] run & path questions

kaz@cadovax.UUCP (10/02/87)

A couple of questions:

1.  Since the code   
       error = Execute( "RUN  whatever ...", 0L, 0L);
    always returns a success, how can your program tell if the
    program you wanted to run was found or not? 

2.  How can you find out what the current PATH is set to within
    a program?

3.  It seems that both Execute and Run will search through the current
    PATH.  Does LoadSeg also do this search, or do you have to specify
    the path in the LoadSeg call?

Thanks to all responders,

Kerry Zimmerman
#  {ucbvax,decvax}!trwrb!cadovax!kaz  Contel Business Systems 213-323-8170

andy@cbmvax.UUCP (10/02/87)

In article <1775@cadovax.UUCP> kaz@cadovax.UUCP (Kerry Zimmerman) writes:
>A couple of questions:
>
>1.  Since the code   
>       error = Execute( "RUN  whatever ...", 0L, 0L);
>    always returns a success, how can your program tell if the
>    program you wanted to run was found or not? 

Its a kluge, I know, but under 1.2 you can get some indication
from IoErr();

>
>2.  How can you find out what the current PATH is set to within
>    a program?

Paths are stored as a BPTR to a BCPL list stored off of the 
CommandDir entry of the CommandLineInterface

>3.  It seems that both Execute and Run will search through the current
>    PATH.  Does LoadSeg also do this search, or do you have to specify
>    the path in the LoadSeg call?

LoadSeg doeesn't do this search.  You'll have to do it yourself.  And,
as a nice gesture for the user, I suggest that you turn off the requesters
and search quietly. (set Process->WindowPtr to -1)

-- 
andy finkel		{ihnp4|seismo|allegra}!cbmvax!andy 
Commodore-Amiga, Inc.

"Interfere?  Of course we'll interfere.  Always do what you're best at,
 I always say."

Any expressed opinions are mine; but feel free to share.
I disclaim all responsibilities, all shapes, all sizes, all colors.

kaz@cadovax.UUCP (Kerry Zimmerman) (10/05/87)

In article <2454@cbmvax.UUCP> andy@cbmvax.UUCP (Andy Finkel) writes:
>In article <1775@cadovax.UUCP> kaz@cadovax.UUCP (Kerry Zimmerman) writes:
>>A couple of questions:
>>
>>1.  Since the code   
>>       error = Execute( "RUN  whatever ...", 0L, 0L);
>>    always returns a success, how can your program tell if the
>>    program you wanted to run was found or not? 
>
>Its a kluge, I know, but under 1.2 you can get some indication
>from IoErr();
>

I tried RUNning both a valid and an invalid program, and in both cases
IoErr() return the same value ( 0xC4 ).  So, what was the indication
you referred to??

>>
>>2.  How can you find out what the current PATH is set to within
>>    a program?
>
>Paths are stored as a BPTR to a BCPL list stored off of the 
>CommandDir entry of the CommandLineInterface
>

I found CommandLineInterface in dosextens.h, but found no other reference
to it.  Please tell me how I can locate this structure from within a
program.   Please include a code fragment for searching the path if
you can afford the time.

>>3.  It seems that both Execute and Run will search through the current
>>    PATH.  Does LoadSeg also do this search, or do you have to specify
>>    the path in the LoadSeg call?
>
>LoadSeg doeesn't do this search.  You'll have to do it yourself.  And,
>as a nice gesture for the user, I suggest that you turn off the requesters
>and search quietly. (set Process->WindowPtr to -1)
>

Thats what I thought.   Thanks for the tip, too.

>andy finkel		{ihnp4|seismo|allegra}!cbmvax!andy 
>Commodore-Amiga, Inc.
>

Kerry Zimmerman
#  {ucbvax,decvax}!trwrb!cadovax!kaz  Contel Business Systems 213-323-8170

# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy
# to make rn happy