/// <summary>
 /// Returns the full path to the target of this symbolic link.
 /// </summary>
 /// <param name="it">The symbolic link in question.</param>
 /// <returns>The path to the target of the symbolic link.</returns>
 /// <exception cref="System.ArgumentException">If the file in question is not a symbolic link.</exception>
 public static string GetSymbolicLinkTarget(this FileInfo it)
 {
     if (!it.IsSymbolicLink())
     {
         throw new ArgumentException("file specified is not a symbolic link.");
     }
     return(SymbolicLink.GetTarget(it.FullName));
 }
Exemple #2
0
        /// <summary>
        /// Returns the full path to the target of this symbolic link.
        /// </summary>
        /// <param name="directoryInfo">The symbolic link in question.</param>
        /// <returns>The path to the target of the symbolic link.</returns>
        /// <exception cref="System.ArgumentException">If the directory in question is not a symbolic link.</exception>
        public static string GetSymbolicLinkTarget(this DirectoryInfo directoryInfo)
        {
            if (!directoryInfo.IsSymbolicLink())
            {
                throw new ArgumentException("Specified directory is not a symbolic link.");
            }

            return(SymbolicLink.GetTarget(directoryInfo.FullName));
        }
 /// <summary>
 /// Determines whether this file is a symbolic link.
 /// </summary>
 /// <param name="it">the file in question.</param>
 /// <returns><code>true</code> if the file is, indeed, a symbolic link, <code>false</code> otherwise.</returns>
 public static bool IsSymbolicLink(this FileInfo it)
 {
     return(SymbolicLink.GetTarget(it.FullName) != null);
 }
 /// <summary>
 /// Creates a symbolic link to this file at the specified path.
 /// </summary>
 /// <param name="it">the source file for the symbolic link.</param>
 /// <param name="path">the path of the symbolic link.</param>
 public static void CreateSymbolicLink(this FileInfo it, string path)
 {
     SymbolicLink.CreateFileLink(path, it.FullName);
 }
 /// <summary>
 /// Creates a symbolic link to this file at the specified path.
 /// </summary>
 /// <param name="it">the source file for the symbolic link.</param>
 /// <param name="path">the path of the symbolic link.</param>
 /// <param name="makeTargetPathRelative">whether the target should be made relative to the symbolic link. Default <c>false</c>.</param>
 public static void CreateSymbolicLink(this FileInfo it, string path, bool makeTargetPathRelative)
 {
     SymbolicLink.CreateFileLink(path, it.FullName, makeTargetPathRelative);
 }
Exemple #6
0
 /// <summary>
 /// Determines whether this directory is a symbolic link.
 /// </summary>
 /// <param name="directoryInfo">the directory in question.</param>
 /// <returns><code>true</code> if the directory is, indeed, a symbolic link, <code>false</code> otherwise.</returns>
 public static bool IsSymbolicLink(this DirectoryInfo directoryInfo)
 {
     return(SymbolicLink.GetTarget(directoryInfo.FullName) != null);
 }
Exemple #7
0
 /// <summary>
 /// Creates a symbolic link to this directory at the specified path.
 /// </summary>
 /// <param name="directoryInfo">the source directory for the symbolic link.</param>
 /// <param name="path">the path of the symbolic link.</param>
 public static void CreateSymbolicLink(this DirectoryInfo directoryInfo, string path)
 {
     SymbolicLink.CreateDirectoryLink(path, directoryInfo.FullName);
 }
 /// <summary>
 /// Creates a symbolic link to this directory at the specified path.
 /// </summary>
 /// <param name="directoryInfo">the source directory for the symbolic link.</param>
 /// <param name="path">the path of the symbolic link.</param>
 /// <param name="makeTargetPathRelative">whether the target should be made relative to the symbolic link. Default <c>false</c>.</param>
 public static void CreateSymbolicLink(this DirectoryInfo directoryInfo, string path, bool makeTargetPathRelative)
 {
     SymbolicLink.CreateDirectoryLink(path, directoryInfo.FullName, makeTargetPathRelative);
 }