ConEmu.WinForms.ConEmuStartInfo.InitConEmuLocation C# (CSharp) Method

InitConEmuLocation() private method

private InitConEmuLocation ( ) : string
return string
        private static string InitConEmuLocation()
        {
            // Look alongside this DLL and in a subfolder
            string asmpath = new Uri(Assembly.GetExecutingAssembly().EscapedCodeBase, UriKind.Absolute).LocalPath;
            if(string.IsNullOrEmpty(asmpath))
                return "";
            string dir = Path.GetDirectoryName(asmpath);
            if(string.IsNullOrEmpty(dir))
                return "";

            // ConEmu.exe in the same folder as this control DLL
            string candidate = Path.Combine(dir, ConEmuConstants.ConEmuExeName);
            if(File.Exists(candidate))
                return candidate;

            // ConEmu.exe in a subfolder (it's convenient to have all managed product DLLs in the same folder for assembly resolve, and it might be handy to put multifile native deps like ConEmu in a subfolder)
            candidate = Path.Combine(Path.Combine(dir, ConEmuConstants.ConEmuSubfolderName), ConEmuConstants.ConEmuExeName);
            if(File.Exists(candidate))
                return candidate;

            // Not found by our standard means, rely on user to set path, otherwise will fail to start
            return "";
        }