public static string FindPathForKDiff(string pathFromConfig) { if (string.IsNullOrEmpty(pathFromConfig) || !File.Exists(pathFromConfig)) { string kdiff3path = pathFromConfig; if (EnvUtils.RunningOnUnix()) { // Maybe command -v is better, but didn't work kdiff3path = new Executable("which").GetOutput("kdiff3").Replace("\n", ""); if (string.IsNullOrEmpty(kdiff3path)) { return(null); } } else if (EnvUtils.RunningOnWindows()) { string regkdiff3path = GetRegistryValue(Registry.LocalMachine, "SOFTWARE\\KDiff3", ""); if (regkdiff3path != "") { regkdiff3path += "\\kdiff3.exe"; } kdiff3path = FindFileInFolders("kdiff3.exe", @"KDiff3\", regkdiff3path); if (string.IsNullOrEmpty(kdiff3path)) { return(null); } } return(kdiff3path); } return(null); }
public int GetHashCode(string path) { path = Path.GetFullPath(path).TrimEnd('\\'); if (!EnvUtils.RunningOnUnix()) { path = path.ToLower(); } return(path.GetHashCode()); }
public static bool Equal(string path1, string path2) { path1 = Path.GetFullPath(path1).TrimEnd('\\'); path2 = Path.GetFullPath(path2).TrimEnd('\\'); StringComparison comprasion = EnvUtils.RunningOnUnix() ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase; return(String.Compare(path1, path2, comprasion) == 0); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); _NO_TRANSLATE_versionLabel.Text = string.Format(_version.Text, AppSettings.GitExtensionsVersionString); if (EnvUtils.RunningOnUnix()) { _NO_TRANSLATE_osLabel.Text = "Unix"; } if (EnvUtils.RunningOnMacOSX()) { _NO_TRANSLATE_osLabel.Text = "MacOSX"; } if (EnvUtils.RunningOnWindows()) { _NO_TRANSLATE_osLabel.Text = "Windows"; } }