示例#1
0
    private static string RemoveOtherMakeAndCygwinFromPath(string WindowsPath)
    {
        string[] PathComponents = WindowsPath.Split(';');
        string   NewPath        = "";

        foreach (string PathComponent in PathComponents)
        {
            // Everything that contains /bin or /sbin is suspicious, check if it has make in it
            if (PathComponent.Contains("\\bin") || PathComponent.Contains("/bin") || PathComponent.Contains("\\sbin") || PathComponent.Contains("/sbin"))
            {
                if (File.Exists(PathComponent + "/make.exe") || File.Exists(PathComponent + "make.exe") || File.Exists(PathComponent + "/cygwin1.dll"))
                {
                    LogInformation("Removing {0} from PATH since it contains possibly colliding make.exe", PathComponent);
                    continue;
                }
            }

            NewPath = NewPath + ';' + PathComponent + ';';
        }

        return(NewPath);
    }