summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/mingw32.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/kpathsea/mingw32.c')
-rw-r--r--Build/source/texk/kpathsea/mingw32.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/Build/source/texk/kpathsea/mingw32.c b/Build/source/texk/kpathsea/mingw32.c
index 6e8b38e899d..c5d2c6e71ab 100644
--- a/Build/source/texk/kpathsea/mingw32.c
+++ b/Build/source/texk/kpathsea/mingw32.c
@@ -404,27 +404,34 @@ 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 = kpse_var_value("TEXLIVE_WINDOWS_EXTERNAL_GS");
+ if (nptr == NULL || *nptr == '0' || *nptr == 'n' || *nptr == 'f') {
+ if (nptr)
+ free (nptr);
+ 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);
}
- nptr = getenv("PATH");
- path = (char *)malloc(strlen(nptr) + strlen(tlgsbindir) + 6);
- strcpy(path, tlgsbindir);
- strcat(path, nptr);
- xputenv("PATH", path);
- xputenv("GS_LIB", tlgslibdir);
}
+ } else {
+ free (nptr);
}
}