avoid deleting the target of `makeJar` if it's not a file

This commit is contained in:
Lars Hupel 2017-03-14 16:20:20 +01:00 committed by Eugene Yokota
parent 0a9dd9678d
commit da7d03ed48
1 changed files with 7 additions and 2 deletions

View File

@ -94,8 +94,13 @@ object Package {
ManifestAttributes((attribKeys zip attribVals) ++ { homepage map (h => (IMPLEMENTATION_URL, h.toString)) }: _*)
}
def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest, log: Logger): Unit = {
log.info("Packaging " + jar.getAbsolutePath + " ...")
IO.delete(jar)
val path = jar.getAbsolutePath
log.info("Packaging " + path + " ...")
if (jar.exists)
if (jar.isFile)
IO.delete(jar)
else
sys.error(path + " exists, but is not a regular file")
log.debug(sourcesDebugString(sources))
IO.jar(sources, jar, manifest)
log.info("Done packaging.")