From 00ebc872307f07fb317bcd03b56b4a1b5dfacad9 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 11 Sep 2018 09:44:22 +0100 Subject: [PATCH] cache pdf files generated by epstopdf --- app/coffee/ResourceWriter.coffee | 2 ++ test/unit/coffee/ResourceWriterTests.coffee | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/app/coffee/ResourceWriter.coffee b/app/coffee/ResourceWriter.coffee index 0b6aef5..85df35d 100644 --- a/app/coffee/ResourceWriter.coffee +++ b/app/coffee/ResourceWriter.coffee @@ -80,6 +80,8 @@ module.exports = ResourceWriter = should_delete = false if path.match(/^output-.*/) # Tikz cached figures should_delete = false + if path.match(/-eps-converted-to\.pdf$/) # Epstopdf generated files + should_delete = false if path == "output.pdf" or path == "output.dvi" or path == "output.log" or path == "output.xdv" should_delete = true if path == "output.tex" # created by TikzManager if present in output files diff --git a/test/unit/coffee/ResourceWriterTests.coffee b/test/unit/coffee/ResourceWriterTests.coffee index fbc8916..66a8a36 100644 --- a/test/unit/coffee/ResourceWriterTests.coffee +++ b/test/unit/coffee/ResourceWriterTests.coffee @@ -134,6 +134,9 @@ describe "ResourceWriter", -> type: "aux" }, { path: "cache/_chunk1" + },{ + path: "figures/image-eps-converted-to.pdf" + type: "pdf" }] @resources = "mock-resources" @OutputFileFinder.findOutputFiles = sinon.stub().callsArgWith(2, null, @output_files) @@ -165,6 +168,11 @@ describe "ResourceWriter", -> .calledWith(path.join(@basePath, "cache/_chunk1")) .should.equal false + it "should not delete the epstopdf converted files", -> + @ResourceWriter._deleteFileIfNotDirectory + .calledWith(path.join(@basePath, "figures/image-eps-converted-to.pdf")) + .should.equal false + it "should call the callback", -> @callback.called.should.equal true