https://kotlinlang.org logo
#stdlib
Title
# stdlib
c

cedric

04/03/2017, 8:58 PM
@orangy The following code throws, is this the expected behavior? It looks like
copyRecursively
is changing the target from a directory to a file:
Copy code
fun main(args: Array<String>) {
    val from = File("/tmp/foo").apply { writeText("I'm a file") }
    val to = File("/tmp/to").apply {
        deleteRecursively()
        mkdirs()
    }
    from.copyRecursively(to, overwrite = true)
    if (! to.isDirectory) {
        throw AssertionError("Should be a directory")
    }
}
o

orangy

04/03/2017, 9:24 PM
I don’t have any idea right now, could you file an issue, or even debug it and tell us what’s wrong?
c

cedric

04/03/2017, 9:30 PM
I think it’s happening in
copyTo
, which
copyRecursively
calls. Haven’t dug further
3 Views