Index: src/hid_init.c =================================================================== --- src/hid_init.c (revision 27829) +++ src/hid_init.c (revision 27830) @@ -439,6 +439,8 @@ return 0; } extern int pcb_mkdir_(const char *path, int mode); +char *pcb_w32_root; +char *pcb_w32_libdir, *pcb_w32_bindir, *pcb_w32_sharedir, *pcb_w32_cachedir; #endif void pcb_fix_locale_and_env() @@ -457,7 +459,7 @@ #ifdef __WIN32__ { - char *s, *libdir, *bindir, *sharedir, exedir[MAX_PATH]; + char *s, exedir[MAX_PATH]; wchar_t *w, wexedir[MAX_PATH]; if (!GetModuleFileNameW(NULL, wexedir, MAX_PATH)) { @@ -471,22 +473,22 @@ truncdir(exedir); - bindir = pcb_strdup(exedir); + pcb_w32_bindir = pcb_strdup(exedir); truncdir(exedir); - libdir = pcb_concat(exedir, "\\lib", NULL); - sharedir = pcb_concat(exedir, "\\share", NULL); + pcb_w32_root = pcb_strdup(exedir); + pcb_w32_libdir = pcb_concat(exedir, "\\lib", NULL); + pcb_w32_sharedir = pcb_concat(exedir, "\\share", NULL); /* printf("WIN32 bindir='%s' libdir='%s' sharedir='%s'\n", bindir, libdir, sharedir);*/ /* set up gdk pixmap modules */ { - char *cache, *cmd; + char *cache, *pcb_w32_cachedir, *cmd; - cache = pcb_concat(exedir, "\\cache", NULL); - pcb_mkdir_(cache, 0755); - free(cache); + pcb_w32_cachedir = pcb_concat(pcb_w32_root, "\\cache", NULL); + pcb_mkdir_(pcb_w32_cachedir, 0755); - cache = pcb_concat(exedir, "\\cache\\gdk-pixmap-loaders.cache", NULL); + cache = pcb_concat(pcb_w32_cachedir, "\\gdk-pixmap-loaders.cache", NULL); pcb_setenv("GDK_PIXBUF_MODULE_FILE", cache, 1); printf("cache='%s' %d\n", cache, pcb_file_readable(cache)); for(s = cache; *s != '\0'; s++) @@ -493,7 +495,7 @@ if (*s == '\\') *s = '/'; if (!pcb_file_readable(cache)) { - cmd = pcb_concat(bindir, "\\gdk-pixbuf-query-loaders --update-cache", NULL); + cmd = pcb_concat(pcb_w32_bindir, "\\gdk-pixbuf-query-loaders --update-cache", NULL); printf("update cache!\n"); system(cmd); free(cmd); Index: src/hid_init.h =================================================================== --- src/hid_init.h (revision 27829) +++ src/hid_init.h (revision 27830) @@ -149,4 +149,12 @@ shall be invoked) */ #define pcbhl_main_exporting (pcb_gui->printer || pcb_gui->exporter) +#ifdef __WIN32__ +extern char *pcb_w32_root; /* installation prefix; what would be $PREFIX on FHS, e.g. /usr/local */ +extern char *pcb_w32_libdir; /* on FHS this would be $PREFIX/lib*/ +extern char *pcb_w32_bindir; /* on FHS this would be $PREFIX/bin - on win32 this also hosts the dlls */ +extern char *pcb_w32_sharedir; /* on FHS this would be $PREFIX/share */ +extern char *pcb_w32_cachedir; /* where to store cache files, e.g. gdk pixbuf loader cache; persistent, but not part of the distribution */ #endif + +#endif