- 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));
- }
- }
-