mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
GH-423: Overwrite files on Windows too.
Fixes https://github.com/cbeust/kobalt/issues/423
This commit is contained in:
parent
c768507ed5
commit
cc481a4a7f
1 changed files with 10 additions and 14 deletions
|
@ -227,9 +227,6 @@ class KFiles {
|
||||||
private fun isWindows() = System.getProperty("os.name").contains("Windows")
|
private fun isWindows() = System.getProperty("os.name").contains("Windows")
|
||||||
|
|
||||||
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()) {
|
|
||||||
kobaltLog(2, "Windows detected, not overwriting $to")
|
|
||||||
} else {
|
|
||||||
try {
|
try {
|
||||||
if (from != null && to != null) {
|
if (from != null && to != null) {
|
||||||
if (!Files.exists(to) || Md5.toMd5(from.toFile()) != Md5.toMd5(to.toFile())) {
|
if (!Files.exists(to) || Md5.toMd5(from.toFile()) != Md5.toMd5(to.toFile())) {
|
||||||
|
@ -244,7 +241,6 @@ class KFiles {
|
||||||
kobaltLog(1, "Couldn't copy $from to $to: ${ex.message}")
|
kobaltLog(1, "Couldn't copy $from to $to: ${ex.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun copy(from: InputStream, to: OutputStream) {
|
fun copy(from: InputStream, to: OutputStream) {
|
||||||
var read = from.read()
|
var read = from.read()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue