Skip to content

Commit

Permalink
Write optimizer version to a file (#3002)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Nov 4, 2023
1 parent 5e757de commit 8263786
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import java.net.URLDecoder
import java.util.zip.GZIPOutputStream

private val urlRe = Regex("""^https?://.*""")

const val EPUB_OPTIMIZER_VERSION = 2

fun EpubBackendState.readOriginal(origId: String): Pair<Document?, Int> {
val file = fileForOriginalId(origId)?: return Pair(null, 0)
val parentFolder = file.parentFile!!
Expand Down Expand Up @@ -259,6 +262,10 @@ fun EpubBackendState.optimizeEpub() {
}
fileForOriginalId(k)?.delete()
}
val versionFile = File(fragDir, "version.txt")
versionFile.outputStream().use {
it.write("$EPUB_OPTIMIZER_VERSION".toByteArray())
}
val total = (System.currentTimeMillis() - start) / 1000
writeDb.close()
optimizeLockFile.delete()
Expand Down

0 comments on commit 8263786

Please sign in to comment.