Skip to content

Commit

Permalink
readOnly tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Jun 11, 2024
1 parent 14c0a80 commit f22d3e6
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,17 @@ abstract class ProcessDocsAction {
)

try {
targetFile.writeText(processedFileContent)
targetFile.setReadOnly()
targetFile.apply {
setWritable(true, false)
delete()
writeText(processedFileContent)
setReadOnly()
}
} catch (e: Exception) {
throw IOException("Could not write to target file $targetFile", e)
}
}
}

parameters.target?.setReadOnly()
}

@Throws(IOException::class)
Expand Down Expand Up @@ -299,16 +301,18 @@ abstract class ProcessDocsAction {
.renderToHtml(theme = addTheme, stripReferences = stripReferences)
val targetFile = File(htmlDir, doc.fullyQualifiedPath + ".html")
try {
targetFile.writeText(html)
targetFile.setReadOnly()
targetFile.apply {
setWritable(true, false)
delete()
writeText(html)
setReadOnly()
}
} catch (e: Exception) {
throw IOException("Could not write to target file $targetFile", e)
}

log.lifecycle { "Exported HTML for ${doc.fullyQualifiedPath} to ${targetFile.absolutePath}" }
}

parameters.exportAsHtmlDir?.setReadOnly()
}

/**
Expand Down

0 comments on commit f22d3e6

Please sign in to comment.