From e024fe36f0f8d717e757803f3b2858913ae9e7c8 Mon Sep 17 00:00:00 2001 From: Stefan Kebekus Date: Thu, 11 Apr 2002 06:40:20 +0000 Subject: [PATCH] bugfix, supposed to fix bug #34822 svn path=/trunk/kdegraphics/kdvi/; revision=148659 --- special.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/special.cpp b/special.cpp index 605ef6ef7..3d7bef135 100644 --- a/special.cpp +++ b/special.cpp @@ -133,29 +133,33 @@ void dviWindow::epsf_special(QString cp) EPSfilename = EPSfilename.mid(1,EPSfilename.length()-2); } - // Now see if the Gfx file exists... + // Now see if the Gfx file exists... try to find it in the current + // directory, in the DVI file's directory, and finally, if all else + // fails, use kpsewhich to find the file. Later on, we should + // probably use the DVI file's baseURL, once this is implemented. if (! QFile::exists(EPSfilename)) { QFileInfo fi1(dviFile->filename); QFileInfo fi2(fi1.dir(),EPSfilename); if (fi2.exists()) EPSfilename = fi2.absFilePath(); - else if (QFile::exists(EPSfilename + QString::fromLatin1(".gz"))) { //try harder to find a gzipped file - EPSfilename = EPSfilename + QString::fromLatin1(".gz"); - //kdDebug(4300) << "gzEps=" << EPSfilename <name(); + delete answerFile; + + KShellProcess proc; + proc << "kpsewhich " << EPSfilename << " >" << answerFileName; + proc.start(KProcess::Block, KProcess::NoCommunication); + QFile resultfile(answerFileName); + resultfile.open(IO_ReadOnly); + resultfile.readLine(EPSfilename,500); + EPSfilename = EPSfilename.stripWhiteSpace(); } }