← Back to team overview

kicad-developers team mailing list archive

[PATCH] Look in PATH for binaries

 

Hi,

This patch makes software to look also in PATH environment variable
directories for binaries to launch.



Best Regards, Denys Kuzmenko.

=== modified file 'common/gestfich.cpp'
--- common/gestfich.cpp 2012-01-26 19:48:45 +0000
+++ common/gestfich.cpp 2012-07-16 23:50:22 +0000
@@ -40,6 +40,8 @@
 #include <wx/mimetype.h>
 #include <wx/filename.h>
 #include <wx/dir.h>
+#include <wx/utils.h>
+#include <wx/tokenzr.h>

 /* List of default paths used to locate help files and KiCad library files.
  *
@@ -409,6 +411,19 @@
             return FullFileName;
     }

+    /* Look in PATH environment variable */
+    wxString path;
+    wxGetEnv(wxT("PATH"), &path);
+
+    wxStringTokenizer tkz(path, wxT(":"));
+    while(tkz.HasMoreTokens())
+    {
+       FullFileName = tkz.GetNextToken() + shortname;
+
+       if( wxFileExists( FullFileName ) )
+                       return FullFileName;
+    }
+
     return shortname;
 }

Attachment: look-in-path.patch
Description: Binary data


Follow ups