1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
Index: src/fccfg.c
===================================================================
--- src/fccfg.c (revision 92)
+++ src/fccfg.c (revision 99)
@@ -28,7 +28,10 @@
#define STRICT
#include <windows.h>
#undef STRICT
+#ifdef SIDEBYSIDE
+#define getenv(x) NULL
#endif
+#endif
#if defined (_WIN32) && !defined (R_OK)
#define R_OK 4
@@ -77,14 +80,14 @@
{
/* If no home, use the temp folder. */
FcChar8 dummy[1];
- int templen = GetTempPath (1, dummy);
+ int templen = GetTempPathA (1, dummy);
FcChar8 *temp = malloc (templen + 1);
if (temp)
{
FcChar8 *cache_dir;
- GetTempPath (templen + 1, temp);
+ GetTempPathA (templen + 1, temp);
cache_dir = FcStrPlus (temp, FC_USER_CACHE_FILE);
free (temp);
if (!FcConfigSetCache (config, cache_dir))
@@ -1585,6 +1588,9 @@
char *home = getenv ("HOME");
#ifdef _WIN32
+#ifdef SIDEBYSIDE
+ return FONTCONFIG_PATH;
+#endif
if (home == NULL)
home = getenv ("USERPROFILE");
#endif
Index: src/fcxml.c
===================================================================
--- src/fcxml.c (revision 92)
+++ src/fcxml.c (revision 99)
@@ -1704,9 +1704,17 @@
break;
}
#ifdef _WIN32
- if (strcmp (data, "WINDOWSFONTDIR") == 0)
+ if (strcmp (data, "WINDOWSFONTDIR") == 0 || strcmp (data, "BINDIR") == 0)
{
int rc;
+ enum dirtype_e {WINDOWSFONTDIR, BINDIR};
+ enum dirtype_e dirtoken;
+
+ if (strcmp (data, "WINDOWSFONTDIR") == 0)
+ dirtoken = WINDOWSFONTDIR;
+ else if (strcmp (data, "BINDIR") == 0)
+ dirtoken = BINDIR;
+
FcStrFree (data);
data = malloc (1000);
if (!data)
@@ -1715,16 +1723,35 @@
break;
}
FcMemAlloc (FC_MEM_STRING, 1000);
- rc = GetWindowsDirectory (data, 800);
- if (rc == 0 || rc > 800)
+ if (dirtoken == BINDIR)
{
- FcConfigMessage (parse, FcSevereError, "GetWindowsDirectory failed");
- FcStrFree (data);
- break;
+ FcChar8 *p;
+ rc = GetModuleFileName (NULL, data, 800);
+ if (rc == 0 || rc > 800)
+ {
+ FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed");
+ FcStrFree (data);
+ break;
+ }
+ p = strrchr (data, '\\');
+ if (p)
+ *p = '\0';
+ else
+ data[0] = '\0';
}
- if (data [strlen (data) - 1] != '\\')
- strcat (data, "\\");
- strcat (data, "fonts");
+ else /* WINDOWSFONTDIR */
+ {
+ rc = GetWindowsDirectory (data, 800);
+ if (rc == 0 || rc > 800)
+ {
+ FcConfigMessage (parse, FcSevereError, "GetWindowsDirectory failed");
+ FcStrFree (data);
+ break;
+ }
+ if (data [strlen (data) - 1] != '\\')
+ strcat (data, "\\");
+ strcat (data, "fonts");
+ }
}
#endif
if (!FcStrUsesHome (data) || FcConfigHome ())
Index: Makefile.am
===================================================================
--- Makefile.am (revision 92)
+++ Makefile.am (revision 99)
@@ -40,7 +40,7 @@
config_DATA=fonts.conf fonts.dtd
install-data-local:
- $(mkinstalldirs) $(DESTDIR)/$(configdir)
+ $(mkinstalldirs) $(DESTDIR)$(configdir)
if [ -f $(DESTDIR)$(configdir)/local.conf ]; then \
echo "not overwriting existing $(DESTDIR)$(configdir)/local.conf"; \
else if [ -f $(srcdir)/local.conf ]; then \
|