#ifdef __WXMSW__
#include <windows.h>
#include "wx/msw/winundef.h"
-#ifdef GetTempPath
+#if defined(GetTempPath) && !defined(__CYGWIN__)
#undef GetTempPath
#endif
#endif
// Only to be used if we fail to find the information installed
// with the Configuration Tool.
config.Read(_("/Paths/BuildToolsDir"), & m_buildToolsDir);
- if (m_buildToolsDir.IsEmpty()) // first invocation by this user
- {
- // we have no clues as to the location of the build tools so
- // test for ../../../gnutools relative to the configtool location
- wxFileName gnutools = wxFileName (wxGetApp().GetAppDir(), wxEmptyString);
- gnutools.Normalize(); // remove trailing "./" if present
- if (2 < gnutools.GetDirCount())
- {
- gnutools.RemoveDir (gnutools.GetDirCount()-1);
- gnutools.RemoveDir (gnutools.GetDirCount()-1);
- gnutools.RemoveDir (gnutools.GetDirCount()-1);
- gnutools.AppendDir (wxT("gnutools"));
- if (gnutools.DirExists()) // we've found the gnutools
- 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__
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())
{
- wxLogNull log;
- wxDir finder(arstrPath[i]);
- wxString filename;
-
- if (finder.IsOpened())
+ bool bMore = finder.GetFirst(& filename, gccExe);
+ while (bMore)
{
- 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);
- }
+ wxString targetName = filename.Left(filename.Find(wxT("-gcc")));
+ m_arstrBinDirs.Set(targetName, arstrPath[i]);
+
+ bMore = finder.GetNext(& filename);
}
}
}
// 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"));
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() )
{
- ecFileName strFile(strFolder);
- strFile += wxT("ls.exe");
- if ( strFile.Exists() )
+ if (!wxArrayStringIsMember(m_userToolPaths, strFolder))
{
- if (!wxArrayStringIsMember(m_userToolPaths, strFolder))
- {
- m_userToolPaths.Add(strFolder);
- }
-
- if ( m_userToolsDir.IsEmpty() )
- {
- m_userToolsDir = strFolder;
- }
+ m_userToolPaths.Add(strFolder);
+ }
+
+ if ( m_userToolsDir.IsEmpty() )
+ {
+ m_userToolsDir = strFolder;
}
}
}
// 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);
}
}
-#ifdef __WXMSW__
- if (m_userToolsDir.IsEmpty())
- m_userToolsDir = GetCygwinInstallPath() + wxT("\\bin");
-#else
+#ifdef __WXGTK__
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);
- }
-
- return strCygwinInstallPath;
-}
-#endif
-
// Save config info
bool ecSettings::SaveConfig()
{
cont = dir.GetNext(& filename);
}
}
-// if (latestDir.IsEmpty())
-// latestDir = wxGetCwd();
+ if (latestDir.IsEmpty())
+ latestDir = wxGetCwd();
return latestDir;
#else
wxMessageBox(wxT("FindLatestVersion() is only implemented for Unix."));