← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Look in PATH for binaries

 

There already is a better way. It's called ldconfig. This is how you manage library paths in Linux. It allows you to add custom paths to your hearts content. You can even add temporary paths in a console for debugging custom libraries. I see no reason add something to KiCad that is handled at the system level. I would not support any patch that would disregard the system level library management. Windows is another story since it does not have a library manager other than the PATH environment variable in which case you would just use the PATH environment variable.

Wayne

On 7/21/2012 12:41 PM, Denis Kuzmenko wrote:
Hi Arius,

I've tried to find some better way but failed.
Any suggestions on how to do it better?
Anyways this code will not break windows but will give additional
feature to Linux distribution.


Best Regards, Denys Kuzmenko.


2012/7/21 arius <cpp.development@xxxxxxxxxxxxxx>:

Hm, this seems not to be a Windows compatible solution, because the path separator there is typically ";".

________________________________
Von: Denis Kuzmenko <dart@xxxxxxxxxxxxxx>
An: kicad-developers@xxxxxxxxxxxxxxxxxxx
Gesendet: 1:55 Dienstag, 17.Juli 2012
Betreff: [Kicad-developers] [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;
}

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp




_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp




Follow ups

References