summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
Diffstat (limited to 'navit')
-rw-r--r--navit/graphics.c16
-rw-r--r--navit/xmlconfig.c23
2 files changed, 36 insertions, 3 deletions
diff --git a/navit/graphics.c b/navit/graphics.c
index 82e489df..2ecf00a7 100644
--- a/navit/graphics.c
+++ b/navit/graphics.c
@@ -1587,18 +1587,28 @@ char *
graphics_icon_path(char *icon)
{
static char *navit_sharedir;
+ char *ret=NULL;
+ struct file_wordexp *wordexp=NULL;
dbg(1,"enter %s\n",icon);
+ if (strchr(icon, '$')) {
+ wordexp=file_wordexp_new(icon);
+ if (file_wordexp_get_count(wordexp))
+ icon=file_wordexp_get_array(wordexp)[0];
+ }
if (icon[0] == '/')
- return g_strdup(icon);
+ ret=g_strdup(icon);
else {
#ifdef HAVE_API_ANDROID
- return g_strdup_printf("res/drawable/%s", icon);
+ ret=g_strdup_printf("res/drawable/%s", icon);
#else
if (! navit_sharedir)
navit_sharedir = getenv("NAVIT_SHAREDIR");
- return g_strdup_printf("%s/xpm/%s", navit_sharedir, icon);
+ ret=g_strdup_printf("%s/xpm/%s", navit_sharedir, icon);
#endif
}
+ if (wordexp)
+ file_wordexp_destroy(wordexp);
+ return ret;
}
static int
diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c
index 0fa97cf5..9a4e0332 100644
--- a/navit/xmlconfig.c
+++ b/navit/xmlconfig.c
@@ -911,6 +911,7 @@ parse_file(struct xmldocument *document, xmlerror **error)
gsize len;
gint line, chr;
gboolean result;
+ char *xmldir,*newxmldir,*xmlfile,*newxmlfile,*sep;
dbg(1,"enter filename='%s'\n", document->href);
#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 12
@@ -922,6 +923,18 @@ parse_file(struct xmldocument *document, xmlerror **error)
g_markup_parse_context_free (context);
return FALSE;
}
+ xmldir=getenv("XMLDIR");
+ xmlfile=getenv("XMLFILE");
+ newxmlfile=g_strdup(document->href);
+ newxmldir=g_strdup(document->href);
+ if (sep=strrchr(newxmldir,'/'))
+ *sep='\0';
+ else {
+ g_free(newxmldir);
+ newxmldir=g_strdup(".");
+ }
+ setenv("XMLDIR",newxmldir,1);
+ setenv("XMLFILE",newxmlfile,1);
document->active=document->xpointer ? 0:1;
document->first=NULL;
document->last=NULL;
@@ -934,6 +947,16 @@ parse_file(struct xmldocument *document, xmlerror **error)
}
g_markup_parse_context_free (context);
g_free (contents);
+ if (xmldir)
+ setenv("XMLDIR",xmldir,1);
+ else
+ unsetenv("XMLDIR");
+ if (xmlfile)
+ setenv("XMLFILE",xmlfile,1);
+ else
+ unsetenv("XMLFILE");
+ g_free(newxmldir);
+ g_free(newxmlfile);
dbg(1,"return %d\n", result);
return result;