diff options
author | albert-github <albert.tests@gmail.com> | 2020-01-07 14:04:41 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2020-01-07 14:04:41 (GMT) |
commit | b96dc0fd971a3569e2a986e833c2eb7f24db69f2 (patch) | |
tree | 3bf65affb4fd1da878f92f00037c12e3a9dd394c /src/portable.cpp | |
parent | f8c32f996cac5db890c29958989d25ada389772b (diff) | |
download | Doxygen-b96dc0fd971a3569e2a986e833c2eb7f24db69f2.zip Doxygen-b96dc0fd971a3569e2a986e833c2eb7f24db69f2.tar.gz Doxygen-b96dc0fd971a3569e2a986e833c2eb7f24db69f2.tar.bz2 |
Possibility to use gswin64c on Windows
On windows the 32 bit executable is called gswin32c, but for the 64-bit systems also a gswin64c exists.
The path is checked for the existing of these executables (with a preference for the 32 bit version).
Diffstat (limited to 'src/portable.cpp')
-rw-r--r-- | src/portable.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/portable.cpp b/src/portable.cpp index e191b26..403b0ea 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -348,10 +348,59 @@ char Portable::pathListSeparator(void) #endif } +#if defined(_WIN32) && !defined(__CYGWIN__) +static const bool ExistsOnPath(const char *fileName) +{ + QFileInfo fi1(fileName); + if (fi1.exists()) return true; + + const char *p = Portable::getenv("PATH"); + char listSep = Portable::pathListSeparator(); + char pathSep = Portable::pathSeparator(); + QCString paths(p); + int strt = 0; + int idx; + while ((idx = paths.find(listSep,strt)) != -1) + { + QCString locFile(paths.mid(strt,idx-strt)); + locFile += pathSep; + locFile += fileName; + QFileInfo fi(locFile); + if (fi.exists()) return true; + strt = idx + 1; + } + // to be sure the last path component is checked as well + QCString locFile(paths.mid(strt)); + if (!locFile.isEmpty()) + { + locFile += pathSep; + locFile += fileName; + QFileInfo fi(locFile); + if (fi.exists()) return true; + } + return false; +} +#endif + const char *Portable::ghostScriptCommand(void) { #if defined(_WIN32) && !defined(__CYGWIN__) - return "gswin32c.exe"; + static char *gsexe = NULL; + if (!gsexe) + { + char *gsExec[] = {"gswin32c.exe","gswin64c.exe"}; + for (int i = 0; i < sizeof(gsExec) / sizeof(*gsExec); i++) + { + if (ExistsOnPath(gsExec[i])) + { + gsexe = gsExec[i]; + return gsexe; + } + } + gsexe = gsExec[0]; + return gsexe; + } + return gsexe; #else return "gs"; #endif |