Partager via


Files.IsExecutable(IPath) Method

Definition

Tests whether a file is executable.

[Android.Runtime.Register("isExecutable", "(Ljava/nio/file/Path;)Z", "", ApiSince=26)]
public static bool IsExecutable (Java.Nio.FileNio.IPath? path);
[<Android.Runtime.Register("isExecutable", "(Ljava/nio/file/Path;)Z", "", ApiSince=26)>]
static member IsExecutable : Java.Nio.FileNio.IPath -> bool

Parameters

path
IPath

the path to the file to check

Returns

true if the file exists and is executable; false if the file does not exist, execute access would be denied because the Java virtual machine has insufficient privileges, or access cannot be determined

Attributes

Remarks

Tests whether a file is executable. This method checks that a file exists and that this Java virtual machine has appropriate privileges to Runtime#exec execute the file. The semantics may differ when checking access to a directory. For example, on UNIX systems, checking for execute access checks that the Java virtual machine has permission to search the directory in order to access file or subdirectories.

Depending on the implementation, this method may require to read file permissions, access control lists, or other file attributes in order to check the effective access to the file. Consequently, this method may not be atomic with respect to other file system operations.

Note that the result of this method is immediately outdated, there is no guarantee that a subsequent attempt to execute the file will succeed (or even that it will access the same file). Care should be taken when using this method in security sensitive applications.

Java documentation for java.nio.file.Files.isExecutable(java.nio.file.Path).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to