1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Warnings.

This commit is contained in:
Cedric Beust 2015-12-19 01:20:26 +04:00
parent 7818280538
commit 0d75f9ad5f

View file

@ -188,12 +188,12 @@ class KFiles {
} else { } else {
val relPath = src.relativeTo(from) val relPath = src.relativeTo(from)
val dstFile = File(dst, relPath) val dstFile = File(dst, relPath)
if (dstFile.exists() && !replaceExisting && !(src.isDirectory() && dstFile.isDirectory())) { if (dstFile.exists() && !replaceExisting && !(src.isDirectory && dstFile.isDirectory)) {
if (onError(dstFile, FileAlreadyExistsException(file = src, if (onError(dstFile, FileAlreadyExistsException(file = src,
other = dstFile, other = dstFile,
reason = "The destination file already exists")) == OnErrorAction.TERMINATE) reason = "The destination file already exists")) == OnErrorAction.TERMINATE)
return false return false
} else if (src.isDirectory()) { } else if (src.isDirectory) {
dstFile.mkdirs() dstFile.mkdirs()
} else { } else {
if (src.copyTo(dstFile, true) != src.length()) { if (src.copyTo(dstFile, true) != src.length()) {
@ -239,7 +239,7 @@ class KFiles {
fun copy(from: Path?, to: Path?, option: StandardCopyOption = StandardCopyOption.REPLACE_EXISTING) { fun copy(from: Path?, to: Path?, option: StandardCopyOption = StandardCopyOption.REPLACE_EXISTING) {
if (isWindows() && to!!.toFile().exists()) { if (isWindows() && to!!.toFile().exists()) {
log(2, "Windows detected, not overwriting ${to}") log(2, "Windows detected, not overwriting $to")
} else { } else {
try { try {
log(2, "Copy from $from to ${to!!}") log(2, "Copy from $from to ${to!!}")