Skip to content

Commit

Permalink
remove old syntex files when synctex is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Mar 10, 2012
1 parent f7ae04d commit 253959d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion src/cpp/session/modules/tex/SessionCompilePdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,17 @@ void removeExistingLogs(const FilePath& texFilePath)
LOG_ERROR(error);
}

void removeExistingSynctex(const FilePath& texFilePath)
{
Error error = ancillaryFilePath(texFilePath, ".synctex").removeIfExists();
if (error)
LOG_ERROR(error);

error = ancillaryFilePath(texFilePath, ".synctex.gz").removeIfExists();
if (error)
LOG_ERROR(error);
}

std::string buildIssuesMessage(const core::tex::LogEntries& logEntries)
{
if (logEntries.empty())
Expand Down Expand Up @@ -581,7 +592,7 @@ class AsyncPdfCompiler : boost::noncopyable,
// configure pdflatex options
pdflatex::PdfLatexOptions options;
options.fileLineError = false;
options.syncTex = true;
options.syncTex = !isTargetRnw() || !concordances.empty();
options.shellEscape = userSettings().enableLaTeXShellEscape();

// get back-end version info
Expand All @@ -604,6 +615,10 @@ class AsyncPdfCompiler : boost::noncopyable,
targetFilePath_.stem() +
".tex");

// remove synctex files if synctex is disabled
if (!options.syncTex)
removeExistingSynctex(texFilePath);

// remove log files if they exist (avoids confusion created by parsing
// old log files for errors)
removeExistingLogs(texFilePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
import com.google.inject.Singleton;

// TODO: caching of synctex info

// TODO: where to get the pdf path from in presenter (last successful?)
// TODO: warn user that firefox satellite can't activate main
// TODO: enable/disable/errors for synctex from wrong source or target or
// from empty/unsaved source or target
// TODO: figure out when we need to do a compile before synctex

//TODO: warn user that firefox satellite can't activate main

@Singleton
public class Synctex
{
Expand Down

0 comments on commit 253959d

Please sign in to comment.