Skip to content

Commit

Permalink
Move and replace filew
Browse files Browse the repository at this point in the history
  • Loading branch information
SeniorZhai committed Apr 17, 2023
1 parent eb9c264 commit a73788f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ fun File.moveTo(target: File) {
throw FileNotFoundException("$absolutePath does not exist.")
}
if (target.exists()) {
throw IOException("Target file ${target.absolutePath} already exists.")
target.delete()
}
val renamed = renameTo(target)
if (!renamed) {
Expand Down

0 comments on commit a73788f

Please sign in to comment.