public static IsSymlink ( [ path ) : bool | ||
path | [ | The path of the file to check. |
return | bool |
public void TestIsSymlinkNoMatch() { using (var tempDir = new TemporaryDirectory("unit-tests")) { string normalFile = Path.Combine(tempDir, "normal"); FileUtils.Touch(normalFile); CygwinUtils.IsSymlink(normalFile).Should().BeFalse(); CygwinUtils.IsSymlink(normalFile, out string target).Should().BeFalse(); } }
public void TestIsSymlinkMatch() { using (var tempDir = new TemporaryDirectory("unit-tests")) { string symlinkFile = Path.Combine(tempDir, "symlink"); File.WriteAllBytes(symlinkFile, _symlinkBytes); File.SetAttributes(symlinkFile, FileAttributes.System); CygwinUtils.IsSymlink(symlinkFile).Should().BeTrue(); CygwinUtils.IsSymlink(symlinkFile, out string target).Should().BeTrue(); target.Should().Be("target"); } }