File.deleteRecursively returns true even if path specified by File does not exist.

False is returned only in case of incomplete deletion.
Distinguish situations when file was not deleted because it's vanished after listing and because of some other error.
This commit is contained in:
Ilya Gorbunov
2015-12-22 19:13:42 +03:00
parent 5e6489f1a2
commit ea3a2eefe7
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -440,7 +440,7 @@ class FilesTest {
assertTrue(dir.deleteRecursively())
assertFalse(dir.exists())
assertFalse(dir.deleteRecursively())
assertTrue(dir.deleteRecursively())
}
@test fun deleteRecursivelyWithFail() {
@@ -449,7 +449,7 @@ class FilesTest {
try {
if (restricted.setReadable(false)) {
if (File(basedir, "7.txt").setReadable(false)) {
basedir.deleteRecursively()
assertFalse(basedir.deleteRecursively(), "Expected incomplete recursive deletion.")
restricted.setReadable(true)
File(basedir, "7.txt").setReadable(true)
var i = 0