]> git.lyx.org Git - features.git/blobdiff - src/LaTeX.cpp
Remove an outdated comment
[features.git] / src / LaTeX.cpp
index 3436645fec13db6e717d8772bd3b151498d13702..22e32d35c33569fe20d647cefb6e55350b9eedf9 100644 (file)
@@ -110,8 +110,6 @@ LaTeX::LaTeX(string const & latex, OutputParams const & rp,
 
 void LaTeX::deleteFilesOnError() const
 {
-       // currently just a dummy function.
-
        // What files do we have to delete?
 
        // This will at least make latex do all the runs
@@ -142,6 +140,9 @@ void LaTeX::deleteFilesOnError() const
        // Also remove the aux file
        FileName const aux(changeExtension(file.absFileName(), ".aux"));
        aux.removeFile();
+
+       // Remove the output file, which is often generated even if error
+       output_file.removeFile();
 }
 
 
@@ -421,6 +422,15 @@ int LaTeX::run(TeXErrors & terr)
 
        // Write the dependencies to file.
        head.write(depfile);
+       if (scanres & NO_OUTPUT) {
+               // A previous run could have left a PDF and since
+               // no PDF is created if NO_OUTPUT, we remove any
+               // existing PDF and temporary files so that an
+               // incorrect PDF is not displayed, which could otherwise
+               // happen if View is run again because the checksum will
+               // be the same so any lingering PDF will be viewed.
+               deleteFilesOnError();
+       }
        LYXERR(Debug::LATEX, "Done.");
        return scanres;
 }
@@ -666,8 +676,8 @@ int LaTeX::scanLogFile(TeXErrors & terr)
                                size_t len = j == string::npos
                                                ? token.substr(i + 1).length()
                                                : j - i - 1;
-                               if (regex_match(token.substr(i + 1, len),
-                                                       sub, child_file)) {
+                               string const substr = token.substr(i + 1, len);
+                               if (regex_match(substr, sub, child_file)) {
                                        string const name = sub.str(1);
                                        child.push(make_pair(name, pnest));
                                        i += len;