/// <summary> /// Creates the directory symbolic link. /// </summary> /// <param name="linkPath">Link path.</param> /// <param name="targetPath">Target path.</param> /// <exception cref="ArgumentNullException"><paramref name="targetPath"/> or <paramref name="linkPath"/> is <see langword="null"/> or empty.</exception> /// <exception cref="ArgumentException"><paramref name="targetPath"/> is equal to the <paramref name="linkPath"/>.</exception> /// <exception cref="DirectoryNotFoundException"><paramref name="targetPath"/> was not found.</exception> /// <exception cref="InvalidOperationException">Symbolic link was not created.</exception> /// <remarks> /// The <c>SE_CREATE_SYMBOLIC_LINK_NAME</c> privilege is required to create symbolic links. /// </remarks> public static void CreateDirectoryLink(string linkPath, string targetPath) { SymlinkHelper.CreateSymbolicLink(linkPath, targetPath, SymbolicLinkFlag.Directory); }
/// <summary> /// Creates the file symbolic link. /// </summary> /// <param name="linkPath">Link path.</param> /// <param name="targetPath">Target path.</param> /// <exception cref="ArgumentNullException"><paramref name="targetPath"/> or <paramref name="linkPath"/> is <see langword="null"/> or empty.</exception> /// <exception cref="ArgumentException"><paramref name="targetPath"/> is equal to the <paramref name="linkPath"/>.</exception> /// <exception cref="FileNotFoundException"><paramref name="targetPath"/> was not found.</exception> /// <exception cref="InvalidOperationException">Symbolic link was not created.</exception> /// <remarks> /// The <c>SE_CREATE_SYMBOLIC_LINK_NAME</c> privilege is required to create symbolic links. /// </remarks> public static void CreateFileLink(string linkPath, string targetPath) { SymlinkHelper.CreateSymbolicLink(linkPath, targetPath, SymbolicLinkFlag.File); }