Commit 9ef6ae5b authored by Marco Mattila's avatar Marco Mattila

Use wxStandardPaths to find out the path to binaries in linux.

parent 5208bf99
...@@ -447,40 +447,7 @@ bool EDA_APP::SetBinDir() ...@@ -447,40 +447,7 @@ bool EDA_APP::SetBinDir()
/* Linux and Unix */ /* Linux and Unix */
#elif defined(__UNIX__) #elif defined(__UNIX__)
m_BinDir = wxStandardPaths().GetExecutablePath();
// Under Linux, if argv[0] doesn't the complete path to the executable,
// it's necessary to obtain it using "which <filename>".
FILE* ftmp;
char Line[1024];
char FileName[1024];
wxString str_arg0;
FileName[0] = 0;
str_arg0 = argv[0];
if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path
{
sprintf( FileName, "which %s > %s", TO_UTF8( str_arg0 ), TMP_FILE );
int ret = system( FileName );
(void) ret;
if( ( ftmp = fopen( TMP_FILE, "rt" ) ) != NULL )
{
const char* line = fgets( Line, 1000, ftmp );
(void) line;
fclose( ftmp );
remove( TMP_FILE );
}
m_BinDir = FROM_UTF8( Line );
}
else
{
m_BinDir = argv[0];
}
#else #else
m_BinDir = argv[0]; m_BinDir = argv[0];
#endif /* __UNIX__ */ #endif /* __UNIX__ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment