Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 824) +++ trunk/src/main.c (revision 825) @@ -1392,7 +1392,6 @@ char *bindir = NULL; char *exec_prefix = NULL; char *pcblibdir = NULL; -char *homedir = NULL; static void InitPaths (char *argv0) @@ -1548,22 +1547,8 @@ } - { - char *tmps; + paths_init_homedir(); - tmps = getenv ("HOME"); - - if (tmps == NULL) { - tmps = getenv ("USERPROFILE"); - } - - if (tmps != NULL) { - homedir = strdup (tmps); - } else { - homedir = NULL; - } - } - resolve_all_paths(fontfile_paths_in, fontfile_paths); } Index: trunk/src/paths.c =================================================================== --- trunk/src/paths.c (revision 824) +++ trunk/src/paths.c (revision 825) @@ -2,18 +2,36 @@ #include #include "paths.h" -extern char *homedir; +char *homedir; +void paths_init_homedir(void) +{ + const char *tmps; + tmps = getenv ("HOME"); + if (tmps == NULL) + tmps = getenv ("USERPROFILE"); + if (tmps != NULL) + homedir = strdup (tmps); + else + homedir = NULL; +} + + void resolve_paths(const char **in, char **out, int numpaths) { for(out; numpaths > 0; numpaths--,in++,out++) { if (*in != NULL) { if (**in == '~') { + int l1, l2; if (homedir == NULL) { Message("can't resolve home dir required for path %s\n", *in); exit(1); } - *out = Concat(homedir, (*in)+1, NULL); + /* avoid Concat() here to reduce dependencies for external tools */ + l1 = strlen(homedir); + l2 = strlen((*in)+1); + *out = malloc(l1+l2+4); + sprintf(*out, "%s/%s", homedir, (*in)+1); } else *out = strdup(*in); Index: trunk/src/paths.h =================================================================== --- trunk/src/paths.h (revision 824) +++ trunk/src/paths.h (revision 825) @@ -20,4 +20,7 @@ } \ } while(0) +extern char *homedir; +/* set up global var homedir */ +void paths_init_homedir(void);