Author: forenr
Date: Wed May 25 15:06:33 2011
New Revision: 38835
URL: http://www.lyx.org/trac/changeset/38835

Log:
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.

Modified:
   lyx-devel/trunk/src/frontends/qt4/GuiView.cpp

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Wed May 25 12:14:25 
2011        (r38834)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Wed May 25 15:06:33 
2011        (r38835)
@@ -3522,14 +3522,16 @@
                                        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;
                        }

Reply via email to