Udostępnij za pośrednictwem


FileSystemProvider.DeleteIfExists(IPath) Method

Definition

Deletes a file if it exists.

[Android.Runtime.Register("deleteIfExists", "(Ljava/nio/file/Path;)Z", "GetDeleteIfExists_Ljava_nio_file_Path_Handler", ApiSince=26)]
public virtual bool DeleteIfExists (Java.Nio.FileNio.IPath? path);
[<Android.Runtime.Register("deleteIfExists", "(Ljava/nio/file/Path;)Z", "GetDeleteIfExists_Ljava_nio_file_Path_Handler", ApiSince=26)>]
abstract member DeleteIfExists : Java.Nio.FileNio.IPath -> bool
override this.DeleteIfExists : Java.Nio.FileNio.IPath -> bool

Parameters

path
IPath

the path to the file to delete

Returns

true if the file was deleted by this method; false if the file could not be deleted because it did not exist

Attributes

Remarks

Deletes a file if it exists. This method works in exactly the manner specified by the Files#deleteIfExists method.

The default implementation of this method simply invokes #delete ignoring the NoSuchFileException when the file does not exist. It may be overridden where appropriate.

Java documentation for java.nio.file.spi.FileSystemProvider.deleteIfExists(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