OpenIDE.UI.RunCommandForm.preparePath C# (CSharp) Method

preparePath() private method

private preparePath ( string textContent, string lookfor, string text ) : string
textContent string
lookfor string
text string
return string
        private string preparePath(string textContent, string lookfor, string text)
        {
            if ((textContent.EndsWith(lookfor) && (textContent.Count(x => x.Equals('"')) % 2) == 0) || textContent.Trim().Length == 0)
                _directoryMode = false;

            var dir = text;
            if (Environment.OSVersion.Platform != PlatformID.Unix && Environment.OSVersion.Platform != PlatformID.MacOSX)
                dir = text.TrimStart(new char[] { Path.DirectorySeparatorChar });
            if (!Directory.Exists(dir) && text.StartsWith(Path.DirectorySeparatorChar.ToString()))
                dir = Path.Combine(_directory, dir.TrimEnd(new char[] { Path.DirectorySeparatorChar }));
            if (!dir.EndsWith(":") && Directory.Exists(dir))
            {
                _directoryMode = true;
                _lastDirectory = dir;
            }
            return dir;
        }