diff -u -r1.34 diritem.c --- diritem.c 2 Dec 2003 19:21:23 -0000 1.34 +++ diritem.c 28 May 2004 13:17:20 -0000 @@ -35,6 +35,7 @@ #include "global.h" +#include "appinfo.h" #include "diritem.h" #include "support.h" #include "gui_support.h" @@ -45,6 +46,7 @@ #include "fscache.h" #include "pixmaps.h" #include "xtypes.h" +#include "xml.h" static Option o_ignore_exec; @@ -210,6 +212,47 @@ } } + +/** + * If there's an tag in AppInfo, set the AppDir path into + * a variable of that name. + */ +void filer_boot(const guchar *fullpath, DirItem *item, int overwrite) +{ + XMLwrapper *info; + xmlNode *node; + + info = appinfo_get(fullpath, item); + if (info && ((node = xml_get_section(info, NULL, "AppDirVar")))) + { + guchar *str; + str = xmlNodeListGetString(node->doc, + node->xmlChildrenNode, 1); + if (str) + { + setenv(str, fullpath, overwrite); + g_free(str); + } + } + if (info) + g_object_unref(info); +} + + +/** + * Wrapper for filer_boot when we've only got a full path. + */ +void filer_boot_path(const guchar *fullpath, int overwrite) +{ + const guchar *leafname = g_basename(fullpath); + DirItem *item = diritem_new(leafname); + + diritem_restat(fullpath, item, NULL); + filer_boot(fullpath, item, overwrite); + //g_free(leafname); +} + + DirItem *diritem_new(const guchar *leafname) { DirItem *item; Index: diritem.h =================================================================== RCS file: /cvsroot/rox/rox/ROX-Filer/src/diritem.h,v retrieving revision 1.12 diff -u -r1.12 diritem.h --- diritem.h 11 Feb 2003 00:14:20 -0000 1.12 +++ diritem.h 28 May 2004 13:17:21 -0000 @@ -43,5 +43,7 @@ DirItem *diritem_new(const guchar *leafname); void diritem_restat(const guchar *path, DirItem *item, struct stat *parent); void diritem_free(DirItem *item); +void filer_boot(const guchar *path, DirItem *item, int overwrite); +void filer_boot_path(const guchar *path, int overwrite); #endif /* _DIRITEM_H */ Index: run.c =================================================================== RCS file: /cvsroot/rox/rox/ROX-Filer/src/run.c,v retrieving revision 1.65 diff -u -r1.65 run.c --- run.c 21 Jan 2004 20:03:16 -0000 1.65 +++ run.c 28 May 2004 13:17:22 -0000 @@ -73,6 +73,7 @@ GString *apprun; const char *argv[] = {NULL, NULL}; + filer_boot_path(path, 1); apprun = g_string_new(path); argv[0] = g_string_append(apprun, "/AppRun")->str;