A Mono.Unix.UnixFileSystemInfo reference containing information about the target of this symbolic link, or null if UnixFileSystemInfo.FullName:
- does not exist, or
- is not a symbolic link.
The behavior will be changed in the future to generate an exception for either of the above error conditions, so current code needs to deal with both exceptions and a null return value. null will not be used by the Mono 1.2 release.
Type Reason ArgumentException UnixFileSystemInfo.FullName is not a symbolic link. [Mono.Unix.Native.Errno.EINVAL] System.IO.DirectoryNotFoundException A component of UnixFileSystemInfo.FullName is not a directory. [Mono.Unix.Native.Errno.ENOTDIR] System.IO.FileNotFoundException UnixFileSystemInfo.FullName [Mono.Unix.Native.Errno.ENOENT] System.IO.IOException An I/O error occurred while reading from the file system. [Mono.Unix.Native.Errno.EIO] System.IO.PathTooLongException A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters. [Mono.Unix.Native.Errno.ENAMETOOLONG] Mono.Unix.UnixIOException Search permission is denied for a component of the path prefix. [Mono.Unix.Native.Errno.EACCES]
-or-
Too many symbolic links were encountered in translating the pathname. [Mono.Unix.Native.Errno.ELOOP]
This really should throw the same exceptions as UnixSymbolicLinkInfo.ContentsPath instead of returning null.
C# Example
UnixFileSystemInfo target =
new UnixSymbolicLinkInfo ("symlink").GetContents ();
while (target != null &&
target.FileType == FileTypes.SymbolicLink) {
target = ((UnixSymbolicLinkInfo) target).GetContents ();
}