Do not call mkdirs when destination file of copyTo doesn't have any parent directory.

#KT-7888 Fixed
This commit is contained in:
Ilya Gorbunov
2015-06-01 18:38:21 +03:00
parent 7f70a4ae89
commit 0302dd06f7
2 changed files with 21 additions and 1 deletions
@@ -218,7 +218,7 @@ public fun File.copyTo(dst: File, overwrite: Boolean = false, bufferSize: Int =
return copyTo(dst.resolve(name), overwrite, bufferSize)
}
}
dst.getParentFile().mkdirs()
dst.getParentFile()?.mkdirs()
dst.delete()
val input = FileInputStream(this)
return input.use<FileInputStream, Long> {