Add symbolic link and void file handling
This commit is contained in:
parent
6389aaa5d0
commit
f7855afc3e
1 changed files with 9 additions and 1 deletions
|
@ -690,6 +690,13 @@ class FileAccess {
|
|||
* If nothing exists at this location,
|
||||
* then nothing will be done.
|
||||
*
|
||||
* If a symbolic link exists at this
|
||||
* location, then the just symbolic link
|
||||
* will be deleted, not the file or
|
||||
* directory it's pointing to. To delete
|
||||
* the target too, use [getLinkDestination]
|
||||
* before calling this method.
|
||||
*
|
||||
* @return this instance
|
||||
* @throws IOAccessException on IO error
|
||||
* @since v1-alpha10
|
||||
|
@ -700,10 +707,11 @@ class FileAccess {
|
|||
try {
|
||||
logger.diag("Deleting '${unformatFromPath(path)}'")
|
||||
|
||||
if (file.isDirectory)
|
||||
if (!isSymbolicLink() && file.isDirectory)
|
||||
Files.walkFileTree(path, DeleteDirectoryVisitor(path))
|
||||
|
||||
Files.delete(path)
|
||||
} catch (_: NoSuchFileException) {
|
||||
} catch (exception: Exception) {
|
||||
throw IOAccessException("Unable to delete '${unformatFromPath(path)}'", exception)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue