From ce655c25c28c05b48570bdb47ebcaf4b77149edf Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Wed, 25 May 2011 13:06:33 +0000 Subject: [PATCH] The time_t type seems to be an unsigned type when compiling with MSVC. Thus, we can't rely on the returned timestamp being -1 if a pdf doesn't exist. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38835 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 683982a2f7..89a00c6609 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -3522,14 +3522,16 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) addExtension(mastername, "dvi"))); FileName const pdfname(addName(path.absFileName(), addExtension(mastername, "pdf"))); - if (!dviname.exists() && !pdfname.exists()) { + bool const have_dvi = dviname.exists(); + bool const have_pdf = pdfname.exists(); + if (!have_dvi && !have_pdf) { dr.setMessage(_("Please, preview the document first.")); break; } string outname = dviname.onlyFileName(); string command = lyxrc.forward_search_dvi; - if (!dviname.exists() || - pdfname.lastModified() > dviname.lastModified()) { + if (!have_dvi || (have_pdf && + pdfname.lastModified() > dviname.lastModified())) { outname = pdfname.onlyFileName(); command = lyxrc.forward_search_pdf; } -- 2.39.2