Duplicating workbench pathlist
Posted: Mon Dec 30, 2013 11:23 am
What is presently the recommended way to duplicate the WB pathlist for applications started from WB that do launch CLI commands without the full path ?
Starting from a 2006 thread http://www.amigacoding.de/index.php?topic=142.0 (REf 1)
it seems programmers make use of one of the following approaches
1. Ralph Babel's cloneWorkBenchPath() function (the gui4Cli launcher "Gui" does) (renamed "gui4" to avoid confusion withthe gui oS4 preferences program"
http://aminet.net/package.php?package=d ... wbpath.lha
It is probably described in his Guru book, which i don't possess
In the thread Thomas explains:
It uses WBStartup->sm_Message.mn_ReplyPort->mp_SigTask->pr_CLI->cli_CommandDir to get a pointer to the Workbench's path list and then clones it by calling DupLock for each node.
To be noted: cli_CommandDir has been replaced cli_PathList since ...
2. Using workbench.library/WorkbenchControlA(
WBCTRLA_DuplicateSearchPath (BPTR *) -
Ref 1 geit, mentions that the following fails under OS4
if( WorkbenchBase->lib_Version >= 44 ) {
WorkbenchControl( NULL, WBCTRLA_DuplicateSearchPath, &path, TAG_DONE );
}
SystemTags( name, NP_StackSize, stack,
SYS_Output, ohandle,
SYS_Input, ihandle,
SYS_Asynch, TRUE,
NP_Path, path,
TAG_DONE );
docommands.h
SystemTags(marg[0].str, SYS_Input, NULL, SYS_Output, conout, NP_StackSize, usestack, TAG_END);
3. Using AllocDosObjectTaglis(DOS_CLI,NULL)
Ref 1:oBarthel:
" Here's what all those Workbench programs do which clone the Workbench path list (e.g. the "CLI" program in "SYS:System"):
struct CommandLineInterface *cli;
cli = AllocDosObjectTagList(DOS_CLI,NULL);
process->pr_CLI = MKBADDR(cli);
process->pr_Flags |= PRF_FREECLI;
Just make sure that you don't overwrite an existing CLI structure, or you'll get the shell into big trouble your program was launched from. Put another way, make sure you don't attempt to clone the search path unless you were really launched by Workbench."
If it's method 3 , could an example be given ?
Starting from a 2006 thread http://www.amigacoding.de/index.php?topic=142.0 (REf 1)
it seems programmers make use of one of the following approaches
1. Ralph Babel's cloneWorkBenchPath() function (the gui4Cli launcher "Gui" does) (renamed "gui4" to avoid confusion withthe gui oS4 preferences program"
http://aminet.net/package.php?package=d ... wbpath.lha
It is probably described in his Guru book, which i don't possess
In the thread Thomas explains:
It uses WBStartup->sm_Message.mn_ReplyPort->mp_SigTask->pr_CLI->cli_CommandDir to get a pointer to the Workbench's path list and then clones it by calling DupLock for each node.
To be noted: cli_CommandDir has been replaced cli_PathList since ...
2. Using workbench.library/WorkbenchControlA(
WBCTRLA_DuplicateSearchPath (BPTR *) -
Ref 1 geit, mentions that the following fails under OS4
if( WorkbenchBase->lib_Version >= 44 ) {
WorkbenchControl( NULL, WBCTRLA_DuplicateSearchPath, &path, TAG_DONE );
}
SystemTags( name, NP_StackSize, stack,
SYS_Output, ohandle,
SYS_Input, ihandle,
SYS_Asynch, TRUE,
NP_Path, path,
TAG_DONE );
docommands.h
SystemTags(marg[0].str, SYS_Input, NULL, SYS_Output, conout, NP_StackSize, usestack, TAG_END);
3. Using AllocDosObjectTaglis(DOS_CLI,NULL)
Ref 1:oBarthel:
" Here's what all those Workbench programs do which clone the Workbench path list (e.g. the "CLI" program in "SYS:System"):
struct CommandLineInterface *cli;
cli = AllocDosObjectTagList(DOS_CLI,NULL);
process->pr_CLI = MKBADDR(cli);
process->pr_Flags |= PRF_FREECLI;
Just make sure that you don't overwrite an existing CLI structure, or you'll get the shell into big trouble your program was launched from. Put another way, make sure you don't attempt to clone the search path unless you were really launched by Workbench."
If it's method 3 , could an example be given ?