$OpenBSD: patch-src_plugins_compilergcc_compilergcc_cpp,v 1.6 2020/06/26 09:41:40 cwen Exp $

Always use cb_console_runner from installed PREFIX.

Index: src/plugins/compilergcc/compilergcc.cpp
--- src/plugins/compilergcc/compilergcc.cpp.orig
+++ src/plugins/compilergcc/compilergcc.cpp
@@ -160,7 +160,7 @@ namespace
 {
     PluginRegistrant<CompilerGCC> reg(_T("Compiler"));
 
-    static const wxString strCONSOLE_RUNNER(platform::windows ? _T("cb_console_runner.exe") : _T("cb_console_runner"));
+    static const wxString strCONSOLE_RUNNER(platform::windows ? _T("cb_console_runner.exe") : _T("${PREFIX}/bin/cb_console_runner"));
     static const wxString strSLASH(_T("/"));
     static const wxString strSPACE(_T(" "));
     static const wxString strQUOTE(platform::windows ? _T("\"") : _T("'"));
@@ -1832,8 +1832,7 @@ int CompilerGCC::RunSingleFile(const wxString& filenam
 
     wxString baseDir = ConfigManager::GetExecutableFolder();
     wxString crunnStr = strQUOTE + baseDir + strSLASH + strCONSOLE_RUNNER + strQUOTE;
-    if ( wxFileExists(baseDir + strSLASH + strCONSOLE_RUNNER) )
-        command << crunnStr << strSPACE;
+        command << strCONSOLE_RUNNER << strSPACE;
 
     if (!command.Replace(_T("$SCRIPT"), exe_filename))
         command << strQUOTE << exe_filename << strQUOTE; // if they didn't specify $SCRIPT, append:
@@ -1950,7 +1949,7 @@ int CompilerGCC::Run(ProjectBuildTarget* target)
                     : EscapeSpaces(m_CdRun);
     wxString crunnStr = platform::windows
                       ? strQUOTE + baseDir + strSLASH + strCONSOLE_RUNNER + strQUOTE
-                      : EscapeSpaces(baseDir + strSLASH + strCONSOLE_RUNNER);
+                      : EscapeSpaces(strCONSOLE_RUNNER);
     wxString hostapStr = platform::windows
                        ? strQUOTE + target->GetHostApplication() + strQUOTE
                        : EscapeSpaces(target->GetHostApplication());
@@ -1988,8 +1987,6 @@ int CompilerGCC::Run(ProjectBuildTarget* target)
 
         if (target->GetUseConsoleRunner())
         {
-            if (wxFileExists(baseDir + strSLASH + strCONSOLE_RUNNER))
-            {
                 command << crunnStr << strSPACE;
 
                 if (!platform::windows)
@@ -2001,7 +1998,6 @@ int CompilerGCC::Run(ProjectBuildTarget* target)
                     QuoteStringIfNeeded(strLinkerPath);
                     command << strLinkerPath << strSPACE;
                 }
-            }
         }
     }
 
