Index: trunk/src/hid_init.c =================================================================== --- trunk/src/hid_init.c (revision 27830) +++ trunk/src/hid_init.c (revision 27831) @@ -479,29 +479,10 @@ pcb_w32_libdir = pcb_concat(exedir, "\\lib", NULL); pcb_w32_sharedir = pcb_concat(exedir, "\\share", NULL); + pcb_w32_cachedir = pcb_concat(pcb_w32_root, "\\cache", NULL); + pcb_mkdir_(pcb_w32_cachedir, 0755); + /* printf("WIN32 bindir='%s' libdir='%s' sharedir='%s'\n", bindir, libdir, sharedir);*/ - - /* set up gdk pixmap modules */ - { - char *cache, *pcb_w32_cachedir, *cmd; - - pcb_w32_cachedir = pcb_concat(pcb_w32_root, "\\cache", NULL); - pcb_mkdir_(pcb_w32_cachedir, 0755); - - 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++) - if (*s == '\\') - *s = '/'; - if (!pcb_file_readable(cache)) { - cmd = pcb_concat(pcb_w32_bindir, "\\gdk-pixbuf-query-loaders --update-cache", NULL); - printf("update cache!\n"); - system(cmd); - free(cmd); - } - free(cache); - } } #endif } Index: trunk/src_plugins/lib_gtk_common/glue_common.c =================================================================== --- trunk/src_plugins/lib_gtk_common/glue_common.c (revision 27830) +++ trunk/src_plugins/lib_gtk_common/glue_common.c (revision 27831) @@ -44,42 +44,32 @@ /*** win32 workarounds ***/ -/* Needed for finding the windows installation directory. Without that - we can't find our fonts and footprint libraries. */ -#ifdef WIN32 -#include -#include -#endif +#ifdef __WIN32__ +#include "hid_init.h" +#include "compat_fs.h" + static void ghid_win32_init(void) { -TODO("Should not use PCB_PACKAGE but pcbhl_app_*"); -#ifdef WIN32 - char *tmps; - char *share_dir; - char *loader_cache; - FILE *loader_file; + char *cache, *cmd, *s; + /* set up gdk pixmap modules - without this XPMs won't be loaded */ + cache = pcb_concat(pcb_w32_cachedir, "\\gdk-pixmap-loaders.cache", NULL); + pcb_setenv("GDK_PIXBUF_MODULE_FILE", cache, 1); - tmps = g_win32_get_package_installation_directory(PCB_PACKAGE "-" PCB_VERSION, NULL); -#define REST_OF_PATH G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S PCB_PACKAGE -#define REST_OF_CACHE G_DIR_SEPARATOR_S "loaders.cache" - share_dir = (char *) malloc(strlen(tmps) + strlen(REST_OF_PATH) + 1); - sprintf(share_dir, "%s%s", tmps, REST_OF_PATH); - - /* Point to our gdk-pixbuf loader cache. */ - loader_cache = (char *) malloc(strlen("bindir_todo12") + strlen(REST_OF_CACHE) + 1); - sprintf(loader_cache, "%s%s", "bindir_todo12", REST_OF_CACHE); - loader_file = fopen(loader_cache, "r"); - if (loader_file) { - fclose(loader_file); - g_setenv("GDK_PIXBUF_MODULE_FILE", loader_cache, TRUE); + for(s = cache; *s != '\0'; s++) + if (*s == '\\') + *s = '/'; + if (!pcb_file_readable(cache)) { + cmd = pcb_concat(pcb_w32_bindir, "\\gdk-pixbuf-query-loaders --update-cache", NULL); + fprintf(stderr, "pcb-rnd: updating gdk loader cache: '%s'...\n", cache); + system(cmd); + free(cmd); } - - free(tmps); -#undef REST_OF_PATH - printf("\"Share\" installation path is \"%s\"\n", "share_dir_todo12"); + free(cache); +} +#else +static void ghid_win32_init(void) {} /* no-op on non-win32 */ #endif -} /*** config ***/