Patch #2135 2007-08-10 16:33

raph_

MinGW autodetection searching in $PATH
Download
2135-MinGW_autodete.patch (964 bytes)
Category
Plugin::Refinement
Status
Accepted
Close date
2007-09-18 18:41
Assigned to
biplab
Index: src/plugins/compilergcc/compilerMINGW.cpp
===================================================================
--- src/plugins/compilergcc/compilerMINGW.cpp    (revision 4363)
+++ src/plugins/compilergcc/compilerMINGW.cpp    (working copy)
@@ -18,6 +18,8 @@
 #include <wx/config.h>
 #include <wx/fileconf.h>
 #include <wx/msgdlg.h>
+#include <wx/filename.h>
+#include <wx/filefn.h>
 #include "manager.h"
 #include "messagemanager.h"
 #include "compilerMINGWgenerator.h"
@@ -203,6 +205,16 @@
 
 AutoDetectResult CompilerMINGW::AutoDetectInstallationDir()
 {
+    // try to find MinGW in environment variable PATH first
+    wxPathList list;
+    list.AddEnvList(_T("PATH"));
+    wxString path = list.FindAbsoluteValidPath(m_Programs.C);
+    if (!path.IsEmpty())
+    {
+        m_MasterPath = wxFileName(path).GetPath(wxPATH_GET_VOLUME);
+        return adrDetected;
+    }
+
     wxString sep = wxFileName::GetPathSeparator();
     if (platform::windows)
     {
biplab 2007-09-18 18:41

Thank you for the patch.