File.CanonicalPath Property

Definition

Returns the canonical pathname string of this abstract pathname.

public virtual string CanonicalPath { [Android.Runtime.Register("getCanonicalPath", "()Ljava/lang/String;", "GetGetCanonicalPathHandler")] get; }
[<get: Android.Runtime.Register("getCanonicalPath", "()Ljava/lang/String;", "GetGetCanonicalPathHandler")>]
member this.CanonicalPath : string

Property Value

The canonical pathname string denoting the same file or directory as this abstract pathname

Attributes

Exceptions

if an I/O error occurs.

Remarks

Returns the canonical pathname string of this abstract pathname.

A canonical pathname is both absolute and unique. The precise definition of canonical form is system-dependent. This method first converts this pathname to absolute form if necessary, as if by invoking the #getAbsolutePath method, and then maps it to its unique form in a system-dependent way. This typically involves removing redundant names such as "." and ".." from the pathname, resolving symbolic links (on UNIX platforms), and converting drive letters to a standard case (on Microsoft Windows platforms).

Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that denotes a nonexistent file or directory also has a unique canonical form. The canonical form of the pathname of a nonexistent file or directory may be different from the canonical form of the same pathname after the file or directory is created. Similarly, the canonical form of the pathname of an existing file or directory may be different from the canonical form of the same pathname after the file or directory is deleted.

Added in JDK1.1.

Java documentation for java.io.File.getCanonicalPath().

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