public static bool ExistsForFile(string fullpath, string hintpath = null) { if (SvnIntegration.AppliesToFile(fullpath, hintpath)) { return(SvnIntegration.IsSymlink(fullpath)); } return(false); }
public static bool Exists(FileSystemInfo info, string hintpath = null) { if (SvnIntegration.AppliesTo(info, hintpath)) { return(SvnIntegration.IsSymlink(info.FullName)); } if (info.Exists) { return((info.Attributes & FileAttributes.ReparsePoint) != 0); } return(false); }
public static bool Exists(string path) { if (SvnIntegration.AppliesTo(path)) { return(SvnIntegration.IsSymlink(path)); } path = path.EndsWith("/") ? path.Remove(path.Length - 1) : path; FileInfo file = new FileInfo(path); if (file.Exists) { return((file.Attributes & FileAttributes.ReparsePoint) != 0); } DirectoryInfo dir = new DirectoryInfo(path); return(dir.Exists && ((dir.Attributes & FileAttributes.ReparsePoint) != 0)); }
public static string GetTarget(string path) { if (!Exists(path)) { return(null); } if (SvnIntegration.AppliesTo(path)) { return(SvnIntegration.GetSymlinkTarget(path)); } if (MultiArchPInvoke.IsRunningOnMono) { return(SymlinkMono.GetTarget(path)); } else { return(SymlinkWin32.GetTarget(path)); } }
public static bool Create(string path, string target, bool clearExisting = false) { if (clearExisting) { try { if (Exists(path)) { Delete(path); } else if (File.Exists(path)) { File.Delete(path); } else if (Directory.Exists(path)) { Directory.Delete(path); } } catch { Printer.PrintError("Could not create symlink {0}, it is obstructed!", path); return(false); } } if (SvnIntegration.AppliesTo(path)) { return(SvnIntegration.CreateSymlink(path, target)); } if (MultiArchPInvoke.IsRunningOnMono) { return(SymlinkMono.CreateSymlink(path, target)); } else { return(SymlinkWin32.CreateSymlink(path, target)); } }
public static void Delete(string path) { if (!Exists(path)) { return; } if (SvnIntegration.AppliesTo(path)) { SvnIntegration.DeleteSymlink(path); return; } if (MultiArchPInvoke.IsRunningOnMono) { SymlinkMono.Delete(path); } else { SymlinkWin32.Delete(path); } }