📄 appsettings.cpp
字号:
m_buildToolsDir = gnutools.GetFullPath(); } } // look for *objcopy in and under the build tools directory if (! m_buildToolsDir.IsEmpty()) { wxArrayString objcopyFiles; wxString objcopyFileSpec(wxT("objcopy"));#ifdef __WXMSW__ objcopyFileSpec += wxT(".exe");#endif size_t objcopyCount = wxDir::GetAllFiles(m_buildToolsDir, &objcopyFiles, wxT("*") + objcopyFileSpec, wxDIR_FILES | wxDIR_DIRS); for (int count=0; count < objcopyCount; count++) { wxFileName file (objcopyFiles [count]); wxString new_prefix (file.GetFullName().Left (file.GetFullName().Find(objcopyFileSpec))); if ((! new_prefix.IsEmpty()) && ('-' == new_prefix.Last())) new_prefix = new_prefix.Left (new_prefix.Len() - 1); // strip off trailing hyphen m_arstrBinDirs.Set(new_prefix, file.GetPath(wxPATH_GET_VOLUME)); } } if (!config.Read(_("/Build/Make Options"), & m_strMakeOptions)) {#ifdef __WXMSW__ SYSTEM_INFO SystemInfo; GetSystemInfo(&SystemInfo);// disable -j option for now due to problem with Cygwin 1.3.18// m_strMakeOptions.Printf(_T("-j%d"),SystemInfo.dwNumberOfProcessors);#endif } // Set default build tools binary directories as specified by the installer ecFileName strDefaultBuildToolsPath;#ifdef __WXMSW__ { // This should look in HKEY_LOCAL_MACHINE wxConfig config2(wxT("eCos"), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE); wxString versionKey = GetInstallVersionKey(); wxConfigPathChanger path(& config2, wxString(wxT("/")) + versionKey + wxT("/")); if (!versionKey.IsEmpty() && config2.Read(wxT("Default Build Tools Path"), & strDefaultBuildToolsPath)) {#ifdef __WXMSW__ wxString gccExe(wxT("*-gcc.exe"));#else wxString gccExe(wxT("*-gcc"));#endif // Note that this is not a recursive search. Compilers for // different targets may be in the same directory. This finds all targets. // look for *-gcc[.exe] in the default build tools directory wxLogNull log; wxDir finder(strDefaultBuildToolsPath); wxString filename; if (finder.IsOpened()) { bool bMore = finder.GetFirst(& filename, gccExe); while (bMore) { wxString targetName = filename.Left(filename.Find(wxT("-gcc"))); m_arstrBinDirs.Set(targetName, strDefaultBuildToolsPath); bMore = finder.GetNext(& filename); } } } }#endif#ifndef __WXMSW__ // Look in the PATH for build tools, under Unix { wxString strPath; if (wxGetEnv(wxT("PATH"), & strPath)) { wxString gccExe(wxT("*-gcc")); wxArrayString arstrPath; ecUtils::Chop(strPath, arstrPath, wxT(':')); for (int i = arstrPath.GetCount()-1;i >= 0; --i) { // Reverse order is important to treat path correctly if (wxT(".") != arstrPath[i] && !arstrPath[i].IsEmpty()) { wxLogNull log; wxDir finder(arstrPath[i]); wxString filename; if (finder.IsOpened()) { bool bMore = finder.GetFirst(& filename, gccExe); while (bMore) { wxString targetName = filename.Left(filename.Find(wxT("-gcc"))); m_arstrBinDirs.Set(targetName, arstrPath[i]); bMore = finder.GetNext(& filename); } } } } } }#endif // Read build tools directories (current user) { wxConfigPathChanger path(& config, wxT("/Build Tools/")); //config.SetPath(wxT("/Build Tools")); wxString key(wxT("")); long index; bool bMore = config.GetFirstEntry(key, index); while (bMore) { wxString value; if (config.Read(key, & value)) { m_arstrBinDirs.Set(key, value); } bMore = config.GetNextEntry(key, index); } } // Read toolchain paths (local machine again)#ifdef __WXMSW__ wxArrayString arstrToolChainPaths; // Use eCos just as a test. //GetRepositoryRegistryClues(arstrToolChainPaths,_T("eCos")); GetRepositoryRegistryClues(arstrToolChainPaths,_T("GNUPro eCos")); size_t i; for (i = (size_t) 0; i < arstrToolChainPaths.GetCount(); i++) { ecFileName strDir(arstrToolChainPaths[i]); strDir += wxT("H-i686-cygwin32\\bin"); if (strDir.IsDir()) { // This is a potential toolchain location. Look for *-gcc.exe wxLogNull log; wxDir finder(strDefaultBuildToolsPath); wxString filename; if (finder.IsOpened()) { bool bMore = finder.GetFirst(& filename, wxT("*-gcc.exe")); while (bMore) { // TODO: if there is more than one path, we will have to // check the existance of this target name in m_arstrBinDirs and // append to the end, or something. wxString targetName = filename.Left(filename.Find(wxT("-gcc"))); m_arstrBinDirs.Set(targetName, strDefaultBuildToolsPath); bMore = finder.GetNext(& filename); } } } } // The official user tools are now Cygwin 00r1. If you can't find these, // try GNUPro unsupported. GetRepositoryRegistryClues(m_userToolPaths, wxT("GNUPro 00r1")); if (m_userToolPaths.GetCount() == 0) { GetRepositoryRegistryClues(m_userToolPaths, wxT("Cygwin 00r1")); } if (m_userToolPaths.GetCount() > 0) { for ( i = (size_t) 0 ; i < m_userToolPaths.GetCount(); i++) { ecFileName str(m_userToolPaths[i]); str += "H-i686-cygwin32\\bin"; if(str.IsDir()) { m_userToolPaths[i] = str; } else { m_userToolPaths.Remove(i); i--; } } } else { GetRepositoryRegistryClues(m_userToolPaths, wxT("GNUPro unsupported")); for ( i = (size_t) 0 ; i < m_userToolPaths.GetCount(); i++) { ecFileName str(m_userToolPaths[i]); str += "H-i686-cygwin32\\bin"; if(str.IsDir()) { m_userToolPaths[i] = str; } else { m_userToolPaths.Remove(i); i--; } } }#endif // Include the path in the set of potential user paths { wxString strPath; if (wxGetEnv(wxT("PATH"), & strPath)) { wxArrayString arstrPath; ecUtils::Chop(strPath, arstrPath, wxT(';')); for (int i = arstrPath.GetCount()-1;i >= 0; --i) { // Reverse order is important to treat path correctly const ecFileName &strFolder = arstrPath[i]; if (wxT(".") != strFolder && !strFolder.IsEmpty()) { ecFileName strFile(strFolder); strFile += wxT("ls.exe"); if ( strFile.Exists() ) { if (!wxArrayStringIsMember(m_userToolPaths, strFolder)) { m_userToolPaths.Add(strFolder); } if ( m_userToolsDir.IsEmpty() ) { m_userToolsDir = strFolder; } } } } } } // Load current repository from eCos Configuration Tool/Paths/RepositoryDir { wxConfig eCosConfig(wxGetApp().GetSettings().GetConfigAppName(), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE); wxConfigPathChanger path(& config, wxT("/Repository/")); //if (!eCosConfig.Read(wxT("Folder"), & m_strRepository)) if (!eCosConfig.Read(wxT("/Paths/RepositoryDir"), & m_strRepository)) {#ifdef __WXMSW__ // If we can't find the current folder, look for clues in the registry. wxArrayString arstr; switch (GetRepositoryRegistryClues(arstr, wxT("eCos"))) { case 0: break; case 1: default: m_strRepository = arstr[0]; break; }#elif defined(__WXGTK__) // If we can't find the current folder, look for the latest version // in /opt/ecos m_strRepository = FindLatestVersion();#else // Unsupported platform m_strRepositor = wxEmptyString;#endif } // If we have set ECOS_REPOSITORY, this overrides whatever we have // read or found. wxString envVarValue = wxGetenv(wxT("ECOS_REPOSITORY")); if (!envVarValue.IsEmpty()) { // Note that ECOS_REPOSITORY has the packages (or ecc) folder in the name. // In order to be in the form that is compatible with configtool operation, // it needs to have that stripped off. envVarValue = ecUtils::PosixToNativePath(envVarValue); // accommodate posix-style ECOS_REPOSITORY value under Cygwin wxString packagesName = wxFileNameFromPath(envVarValue); if (packagesName == wxT("ecc") || packagesName == wxT("packages")) envVarValue = wxPathOnly(envVarValue); m_strRepository = envVarValue; } }#ifdef __WXMSW__ if (m_userToolsDir.IsEmpty()) m_userToolsDir = GetCygwinInstallPath() + wxT("\\bin");#else if (m_userToolsDir.IsEmpty()) m_userToolsDir = wxT("/bin");#endif return TRUE;}#ifdef __WXMSW__wxString ecSettings::GetCygwinInstallPath(){ HKEY hKey = 0; DWORD type; BYTE value[256]; DWORD sz = sizeof(value); wxString strCygwinInstallPath; // look for the "/" mount point in the system registry settings if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Cygnus Solutions\\Cygwin\\mounts v2\\/", 0, KEY_READ, &hKey)) { if (ERROR_SUCCESS == RegQueryValueEx(hKey, "native", NULL, & type, value, & sz)) { strCygwinInstallPath = (const char*) value; } RegCloseKey(hKey); } // if not yet found, look for the "/" mount point in the user's registry settings hKey = 0; sz = sizeof(value); if (strCygwinInstallPath.IsEmpty() && (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Cygnus Solutions\\Cygwin\\mounts v2\\/", 0, KEY_READ, &hKey))) { if (ERROR_SUCCESS == RegQueryValueEx(hKey, "native", NULL, & type, value, & sz)) { strCygwinInstallPath = (const char*) value; } RegCloseKey(hKey);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -