When starting my program from a Shell I can get the program's name via argv. (What it is on disk)
How do I get when started from WB? I do this to check where started from:
- ThisProcess=(struct Process *)IExec->FindTask(NULL);
- if (ThisProcess->pr_CLI)
I would like to get it from ThisProcess if possible.
Edit: Entire path would be good, too. Can get name from that if need to.
If argc is 0 then your program was started from WB and argv will contain a pointer to a WBStartup structure.
wbmsg->sm_ArgList will always point to your program similar to argv.
To convert the wbarg into a path you need to do:
I don't know if that information is available through 'ThisProcess', but I use(d) these steps:
a: check whether argc is 0 as this indicates WB-started, in which case:
b: argv holds a pointer to struct WBStartUp, which in turn:
c: in member 'sm_ArgList' holds a pointer to an array of struct WBArg, which in turn:
d: provides the members wa_Lock and wa_Name.
The first occurrance of struct WBArg containing the lock to the full fath of the program (IIRC) as well as the name of the program.
IIRC. I used to use something like this, but don't shoot me if I got it all wrong, as I haven't had my coffee yet:
Hope this helps.
EDIT: problem was addressed to already
You may want to read this.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
I had one of those 2:00AM "oh duh!" moments and figured out my problem. I was close. But I did pick up an idea from the examples!