AutoDetectResult CompilerCYGWIN::AutoDetectInstallationDir() { AutoDetectResult ret = adrGuessed; m_MasterPath = _T("C:\\Cygwin"); // just a guess wxString tempMasterPath(m_MasterPath); bool validInstallationDir = false; // look in registry for Cygwin #ifdef __WXMSW__ wxRegKey key; // defaults to HKCR key.SetName(_T("HKEY_LOCAL_MACHINE\\Software\\Cygwin\\setup")); if (key.Exists() && key.Open(wxRegKey::Read)) { // found CygWin version 1.7 or newer; read it key.QueryValue(_T("rootdir"), tempMasterPath); if (wxDirExists(tempMasterPath + wxFILE_SEP_PATH + _T("bin"))) validInstallationDir = true; } if (!validInstallationDir) { key.SetName(_T("HKEY_LOCAL_MACHINE\\Software\\Cygnus Solutions\\Cygwin\\mounts v2\\/")); if (key.Exists() && key.Open(wxRegKey::Read)) { // found CygWin version 1.5 or older; read it key.QueryValue(_T("native"), tempMasterPath); if ( wxDirExists(tempMasterPath + wxFILE_SEP_PATH + _T("bin")) ) validInstallationDir = true; } } #endif // __WXMSW__ if (!validInstallationDir) return ret; wxString cProgramDir = tempMasterPath + wxFILE_SEP_PATH + _T("bin") + wxFILE_SEP_PATH; wxString cProgramFullname = cProgramDir + m_Programs.C; if ( !wxFileExists(cProgramFullname) ) return ret; wxFile pfFile(cProgramFullname); if ( !pfFile.IsOpened() ) return ret; char buffer[10] = {0}; pfFile.Read(buffer,10); if (memcmp("!<symlink>", buffer, 10) != 0) { m_MasterPath = tempMasterPath; ret = adrDetected; } return ret; }
Smt_Uint TConfigFile::ReadConfigFile() { Smt_String strVal; Smt_PrivateProfile pfFile( m_FileName ); // // CMU config // pfFile.GetPrivateProfileString("CMUConfiger", "CMUIP", "", strVal ); m_CMUIP = strVal; m_CMUPort = pfFile.GetPrivateProfileInt("CMUConfiger", "CMUPort", 0 ); pfFile.GetPrivateProfileString("CMUConfiger", "ServerName", "", strVal ); m_CMUServerName = strVal; pfFile.GetPrivateProfileString("CMUConfiger", "ServerLog", "", strVal ); m_CMUServerLogName = strVal; m_CMUServerLogLevel = pfFile.GetPrivateProfileInt("CMUConfiger", "ServerLogLevel", 0 ); pfFile.GetPrivateProfileString("CMUConfiger", "UserName", "", strVal ); m_CMUUserName = strVal; pfFile.GetPrivateProfileString("CMUConfiger", "UserLog", "", strVal ); m_CMUUserLogName = strVal; m_CMUUserLogLevel = pfFile.GetPrivateProfileInt("CMUConfiger", "UserLogLevel", 0 ); pfFile.GetPrivateProfileString("CMUConfiger", "CallStateLog", "", strVal ); m_CMUCallStateLogName = strVal; m_CMUCallStateLogLevel = pfFile.GetPrivateProfileInt("CMUConfiger", "CallStateLogLevel", 0 ); pfFile.GetPrivateProfileString("CMUConfiger", "DeviceStateLog", "", strVal ); m_CMUDeviceStateLogName = strVal; m_CMUDeviceStateLogLevel = pfFile.GetPrivateProfileInt("CMUConfiger", "DeviceStateLogLevel", 0 ); // // Asterisk info config // pfFile.GetPrivateProfileString("CMUConfiger", "ASTIP", "", strVal ); m_ASTIP = strVal; m_AMIPort = pfFile.GetPrivateProfileInt("CMUConfiger", "AMIPort", 0 ); pfFile.GetPrivateProfileString("CMUConfiger", "AMIUser", "", strVal ); m_AMIUser = strVal; pfFile.GetPrivateProfileString("CMUConfiger", "AMIPassword", "", strVal ); m_AMIPassword = strVal; pfFile.GetPrivateProfileString("CMUConfiger", "ASTConnLog", "", strVal ); m_ASTConnLog = strVal; m_ASTConnLogLevel = pfFile.GetPrivateProfileInt("CMUConfiger", "ASTConnLogLevel", 0 ); pfFile.GetPrivateProfileString("CMUConfiger", "AGIIP", "", strVal ); m_AGIIP = strVal; m_AGIPort = pfFile.GetPrivateProfileInt("CMUConfiger", "AGIPort", 0 ); m_nSSTransTimerLen = pfFile.GetPrivateProfileInt("CMUConfiger", "SSTransTimerLen", 0 ); m_nPreStateTimerLen = pfFile.GetPrivateProfileInt("CMUConfiger", "PreStateTimerLen", 0 ); return Smt_Success; }