Creates the symbolic link UnixFileSystemInfo.FullName which refers to the symbolic link target path.
- path
- A string containing the target of this symbolic link instance.
Type Reason System.IO.DirectoryNotFoundException A component of UnixFileSystemInfo.FullName is not a directory. [Mono.Unix.Native.Errno.ENOTDIR] System.IO.FileNotFoundException path does not exist. [Mono.Unix.Native.Errno.ENOENT] System.IO.IOException An I/O error occurred while making the directory entry for UnixFileSystemInfo.FullName or allocating the inode for UnixFileSystemInfo.FullName or writing out the link contents of UnixFileSystemInfo.FullName. [Mono.Unix.Native.Errno.EIO]
-or-
The file UnixFileSystemInfo.FullName would reside on a read-only file system. [Mono.Unix.Native.Errno.EROFS]
-or-
The directory in which the entry for the new symbolic link is being placed cannot be extended because there is no space left on the file system containing the directory. [Mono.Unix.Native.Errno.ENOSPC]
-or-
The new symbolic link cannot be created because there is no space left on the file system that will contain the symbolic link. [Mono.Unix.Native.Errno.ENOSPC]
-or-
There are no free inodes on the file system on which the symbolic link is being created. [Mono.Unix.Native.Errno.ENOSPC]
-or-
An I/O error occurred while making the directory entry or allocating the inode. [Mono.Unix.Native.Errno.EIO]
System.IO.PathTooLongException A component of either pathname exceeded 255 characters, or the entire length of either path name exceeded 1023 characters. [Mono.Unix.Native.Errno.ENAMETOOLONG] Mono.Unix.UnixIOException A component of UnixFileSystemInfo.FullName denies search permission. [Mono.Unix.Native.Errno.EACCES]
-or-
Too many symbolic links were encountered in translating the pathname. [Mono.Unix.Native.Errno.ELOOP]
-or-
The path name pointed at by the UnixFileSystemInfo.FullName argument already exists. [Mono.Unix.Native.Errno.EEXIST]
-or-
The directory in which the entry for the new symbolic link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [Mono.Unix.Native.Errno.EDQUOT]
-or-
The new symbolic link cannot be created because the user's quota of disk blocks on the file system that will contain the symbolic link has been exhausted. [Mono.Unix.Native.Errno.EDQUOT]
-or-
The user's quota of inodes on the file system on which the symbolic link is being created has been exhausted. [Mono.Unix.Native.Errno.EDQUOT]
Creates the symbolic link UnixFileSystemInfo.FullName which refers to the target path.
The path argument is permitted to specify relative or absolute path information. Relative path information is interpreted by the file system as relative to the symbolic link UnixFileSystemInfo.FullName.
Using UnixSymbolicLinkInfo.CreateSymbolicLinkTo instead of UnixFileSystemInfo.CreateSymbolicLink allows relative path information to be preserved within the symbolic link.
The ln(1) command:
sh Example
ln -s target symlinkCan be created using Mono.Unix in two ways. First, it can be created using UnixFileSystemInfo.CreateSymbolicLink:
C# Example
UnixFileInfo f = new UnixFileInfo ("target.ufi"); f.CreateSymbolicLink ("symlink.ufi");Second, it can be created using UnixSymbolicLinkInfo.CreateSymbolicLinkTo:
C# Example
UnixSymbolicLinkInfo s = new UnixSymbolicLinkInfo ("symlink.usli"); s.CreateSymbolicLinkTo ("target.usli");The links created by the above differ; in particular, the target of UnixFileSystemInfo.CreateSymbolicLink is the full path name of the target, while UnixSymbolicLinkInfo.CreateSymbolicLinkTo contains no extra information:
sh Example
$ ls -lF symlink* | cut -c 39- symlink -> target symlink.ufi -> /full/path/to/target.ufi symlink.usli -> target.usli
Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0