home *** CD-ROM | disk | FTP | other *** search
- #include <workbench/workbench.h>
- #include <workbench/startup.h>
- #include <clib/dos_protos.h>
- #include <clib/icon_protos.h>
- #include <clib/exec_protos.h>
-
- struct Library * WorkbenchBase = NULL;
- static BPTR tmplock;
-
- /* ---------------------------------------------------------------------- */
- /* --- DiskObject support functions ------------------------------------- */
- /* ---------------------------------------------------------------------- */
-
- struct DiskObject * getdiskobject(char * programname)
- {
- struct DiskObject * dobj = NULL;
-
- if (WorkbenchBase = OpenLibrary("workbench.library", 36))
- {
- dobj = GetDiskObject(programname) ;
-
- CloseLibrary(WorkbenchBase);
- }
-
- return(dobj);
- }
-
- void remdiskobject(struct DiskObject * dobj)
- {
- if (dobj)
- {
- if (WorkbenchBase = OpenLibrary("workbench.library", 36))
- {
- FreeDiskObject(dobj);
-
- CloseLibrary(WorkbenchBase);
- }
- }
- }
-
- struct DiskObject * AVM_DiskObject = NULL;
- struct WBStartup * WBenchMsg = NULL;
-
- static char* programname;
- static char programpath[256];
- static char actualprogramname[50];
-
- void shell_startup(void) {
- GetProgramName(programpath, 256);
-
- /* --- Get real program name ---------------------------------------- */
-
- programname = FilePart(programpath);
- strcpy(actualprogramname, programname);
-
- /* --- Try to get disk object --------------------------------------- */
-
- // AVM_DiskObject = getdiskobject(programpath);
- strcpy(programpath, "avm:icons/");
- strcat(programpath, actualprogramname);
- AVM_DiskObject = getdiskobject(programpath);
- }
-
- void workbench_startup(char* argv[]) {
- /* --- Workbench startup ---------------------------------------- */
- WBenchMsg = (struct WBStartup *) argv;
-
- programname = WBenchMsg->sm_ArgList->wa_Name;
-
- tmplock = Lock ( programname, ACCESS_READ );
- NameFromLock ( tmplock, programpath, 256 );
- UnLock ( tmplock);
-
- /* --- Get real program name ---------------------------------------- */
-
- programname = FilePart(programpath);
-
- /* --- Try to get disk object --------------------------------------- */
-
- AVM_DiskObject = getdiskobject(programpath);
- }
-
- void shutdown_icon(void) {
- remdiskobject ( AVM_DiskObject );
- }
-
-