|
run external programm the same when main one running from shell and icon |
Posted on: 2019/2/26 12:04
#1 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6818
|
Have that piece of code:
int launch_command(const char *command) {
So, when i want to run external command (such as odyssey for example), then, when i run main binary from the shell all works fine and odyssey runs fine. But when i run main binary from the icon (workbench type), then it says "odyssey: Unknown command" Should i adapt code somehow so it will works and when i run it from icon workbench type too ? |
|
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/26 14:30
#2 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/12/4 23:15 Posts: 2232
|
@kas1e
The problem is that Workbench is not a CLI process so that is no path to inherit from it. (or if there is it's the absolute minimum default of C: CurentDIR: The only solution I ever found was to run the program from shell. |
|
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/26 14:53
#3 |
---|---|---|
Quite a regular
![]() ![]() Joined:
2013/10/17 16:21 From Hungary
Posts: 650
|
Does it work if you use an absolute path? You could temporarily change the current directory to PROGDIR: (GetProgramDir() gives you the lock) and back. Or maybe setting NP_HomeDir to the PROGDIR lock could help.
|
|
_________________
I see the jimmies have been rustled. |
||
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/26 17:25
#4 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2008/1/6 17:56 From Pennsylvania, USA
Posts: 1342
|
@kas1e
I don't think it relates to your problem but I think your code should check the return value for SystemTags() and close the 'in' and 'out' filehandles if SystemTags() fails. |
|
_________________
Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450 |
||
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/26 18:56
#5 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6818
|
I probably can just try it as "appdir:odyssey" for example , that may works and from icon and from shell ?
|
|
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/27 3:18
#6 |
---|---|---|
Just popping in
![]() ![]() Joined:
2007/12/5 3:00 Posts: 65
|
Hmmm. Would appdir:odyssey work if odyssey had not yet been run a first time?
|
|
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/27 6:12
#7 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6818
|
@broadblues
Quote:
Maybe there is a way to add from the code some kind of copy of pathes/etc which holds when one run it as CLI process ? |
|
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/27 7:21
#8 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2006/11/30 11:30 From Finland
Posts: 1799
|
@kas1e
From AutoRun commodity:
static void execute_command(CONST_STRPTR command) {
|
|
|
Re: run external programm the same when main one running from shell and icon |
Posted on: 2019/2/27 11:29
#9 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6818
|
@Salas00
Thanks a bunch ! It just works and from shell and from icon when it workbench type too ! |
|