Add 'noFollowSymbolicLink' argument to 'exists'
This commit is contained in:
parent
f7855afc3e
commit
f0c43d7b53
1 changed files with 6 additions and 2 deletions
|
@ -335,13 +335,17 @@ class FileAccess {
|
||||||
/**
|
/**
|
||||||
* Returns if this file or directory exists.
|
* Returns if this file or directory exists.
|
||||||
*
|
*
|
||||||
|
* @param noFollowSymbolicLink checks the symbolic link destination if `false`, checks the link itself if `true`. Has no effect if there doesn't exist a link at this location
|
||||||
* @return exists?
|
* @return exists?
|
||||||
* @throws IOAccessException on IO error
|
* @throws IOAccessException on IO error
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
@Throws(IOAccessException::class)
|
@Throws(IOAccessException::class)
|
||||||
fun exists(): Boolean {
|
fun exists(noFollowSymbolicLink: Boolean = false): Boolean {
|
||||||
return Files.exists(path)
|
return if (noFollowSymbolicLink)
|
||||||
|
Files.exists(path, LinkOption.NOFOLLOW_LINKS)
|
||||||
|
else
|
||||||
|
Files.exists(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue