summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/mingw32.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-03 11:48:02 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-03 11:48:02 +0000
commit851a4b03b67b2ad9f0748e56c92604c0807237cf (patch)
treedaa36bd95fbada5fe0f10ab0dd4a4d24e75ae9f2 /Build/source/texk/kpathsea/mingw32.c
parentf48f4e04f6b1c29a0f9ef9979c082cb2de160d16 (diff)
More changes to reduce diffs with W32TeX
git-svn-id: svn://tug.org/texlive/trunk@23367 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/mingw32.c')
-rw-r--r--Build/source/texk/kpathsea/mingw32.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/Build/source/texk/kpathsea/mingw32.c b/Build/source/texk/kpathsea/mingw32.c
index f6912365422..c0d037b41ca 100644
--- a/Build/source/texk/kpathsea/mingw32.c
+++ b/Build/source/texk/kpathsea/mingw32.c
@@ -1,6 +1,6 @@
/* mingw32.c: bits and pieces for mingw32
- Copyright 2009, 2010 Taco Hoekwater <taco@luatex.org>.
+ Copyright 2009-2011 Taco Hoekwater <taco@luatex.org>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -31,6 +31,7 @@
#include <kpathsea/mingw32.h>
#include <kpathsea/lib.h>
#include <kpathsea/concatn.h>
+#include <kpathsea/variable.h>
#include <shlobj.h>
#include <errno.h>
@@ -485,4 +486,55 @@ look_for_cmd(const char *cmd, char **app)
}
+/* special TeXLive Ghostscript */
+
+static int is_dir (char *buff)
+{
+ HANDLE h;
+ WIN32_FIND_DATA w32fd;
+
+ if (((h = FindFirstFile (buff, &w32fd))
+ != INVALID_HANDLE_VALUE) &&
+ (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ FindClose (h);
+ return (1);
+ } else {
+ FindClose (h);
+ return (0);
+ }
+}
+
+/*
+ TeXlive uses its own gs in
+ $SELFAUTOPARENT/tlpkg/tlgs
+*/
+void texlive_gs_init(void)
+{
+ char *nptr, *path;
+ char tlgsbindir[512];
+ char tlgslibdir[512];
+ nptr = kpse_var_value("SELFAUTOPARENT");
+ if (nptr) {
+ strcpy(tlgsbindir, nptr);
+ strcat(tlgsbindir,"/tlpkg/tlgs");
+ if(is_dir(tlgsbindir)) {
+ strcpy(tlgslibdir, tlgsbindir);
+ strcat(tlgslibdir, "/lib;");
+ strcat(tlgslibdir, tlgsbindir);
+ strcat(tlgslibdir, "/fonts");
+ strcat(tlgsbindir, "/bin;");
+ free(nptr);
+ for(nptr = tlgsbindir; *nptr; nptr++) {
+ if(*nptr == '/') *nptr = '\\';
+ }
+ nptr = getenv("PATH");
+ path = (char *)malloc(strlen(nptr) + strlen(tlgsbindir) + 6);
+ strcpy(path, tlgsbindir);
+ strcat(path, nptr);
+ xputenv("PATH", path);
+ xputenv("GS_LIB", tlgslibdir);
+ }
+ }
+}
+
#endif /* __MINGW32__ */