summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-01-12 12:50:22 (GMT)
committerGitHub <noreply@github.com>2020-01-12 12:50:22 (GMT)
commit5792512d3c9a27a662d704b8f7a9a9f5fbc05080 (patch)
treecaa1c8d7e0e5b60520082030951714843ac1b2cf /src
parent2cba6e4f7a53eff5a80a3d8b0ad0a66357bb1713 (diff)
parent95723b6842f52dc044c34bd0218b0661d1e59c9e (diff)
downloadDoxygen-5792512d3c9a27a662d704b8f7a9a9f5fbc05080.zip
Doxygen-5792512d3c9a27a662d704b8f7a9a9f5fbc05080.tar.gz
Doxygen-5792512d3c9a27a662d704b8f7a9a9f5fbc05080.tar.bz2
Merge pull request #7489 from albert-github/feature/bug_win_gs
Possibility to use gswin64c on Windows
Diffstat (limited to 'src')
-rw-r--r--src/latexgen.cpp4
-rw-r--r--src/portable.cpp51
2 files changed, 53 insertions, 2 deletions
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index cdda22c..b8cac2f 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -42,6 +42,7 @@
#include "namespacedef.h"
#include "filename.h"
#include "resourcemgr.h"
+#include "portable.h"
static bool DoxyCodeOpen = FALSE;
static bool DoxyCodeLineOpen = FALSE;
@@ -421,7 +422,8 @@ static void writeMakeBat()
t << mkidx_command << " refman.idx\n";
t << "%LATEX_CMD% refman.tex\n";
t << "dvips -o refman.ps refman.dvi\n";
- t << "gswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
+ t << Portable::ghostScriptCommand();
+ t << " -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
"-sOutputFile=refman.pdf -c save pop -f refman.ps\n";
}
else // use pdflatex
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