Loading common/edaappl.cpp +23 −14 Original line number Diff line number Diff line Loading @@ -199,20 +199,29 @@ void WinEDA_App::InitOnLineHelp() /*******************************/ bool WinEDA_App::SetBinDir() /*******************************/ /* * Analyse la ligne de commande pour retrouver le chemin de l'executable * Sauve en WinEDA_App::m_BinDir le repertoire de l'executable */ // Find the path to the executable and store it in WinEDA_App::m_BinDir { /* Calcul du chemin ou se trouve l'executable */ #ifdef __UNIX__ /* Sous LINUX ptarg[0] ne donne pas le chemin complet de l'executable, * il faut le retrouver par la commande "which <filename> si aucun * chemin n'est donne */ #ifdef __APPLE__ // Derive path from location of the app bundle CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle == NULL) return false; CFURLRef urlref = CFBundleCopyBundleURL(mainBundle); if (urlref == NULL) return false; CFStringRef str = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle); if (str == NULL) return false; char *native_str = NULL; int len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8) + 1; native_str = new char[len]; CFStringGetCString(str, native_str, len, kCFStringEncodingUTF8); m_BinDir = CONV_FROM_UTF8(native_str); delete[] native_str; #elif defined(__UNIX__) // Under Linux, if argv[0] doesn't the complete path to the executable, // it's necessary to obtain it using "which <filename>". FILE* ftmp; #define TMP_FILE "/tmp/kicad.tmp" Loading @@ -223,7 +232,7 @@ bool WinEDA_App::SetBinDir() FileName[0] = 0; str_arg0 = argv[0]; if( strchr( (const char*) argv[0], '/' ) == NULL ) /* pas de chemin */ if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path { sprintf( FileName, "which %s > %s", CONV_TO_UTF8( str_arg0 ), TMP_FILE ); ii = system( FileName ); Loading common/gestfich.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -464,19 +464,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para wxString FullFileName; #ifdef __WXMAC__ // Mac part wxGetEnv( "HOME", &FullFileName ); FullFileName += wxString( "/bin/" ) + ExecFile; if( !wxFileExists( FullFileName ) ) { FullFileName = FindKicadFile( ExecFile ); } #else FullFileName = FindKicadFile( ExecFile ); #endif if( wxFileExists( FullFileName ) ) { Loading Loading
common/edaappl.cpp +23 −14 Original line number Diff line number Diff line Loading @@ -199,20 +199,29 @@ void WinEDA_App::InitOnLineHelp() /*******************************/ bool WinEDA_App::SetBinDir() /*******************************/ /* * Analyse la ligne de commande pour retrouver le chemin de l'executable * Sauve en WinEDA_App::m_BinDir le repertoire de l'executable */ // Find the path to the executable and store it in WinEDA_App::m_BinDir { /* Calcul du chemin ou se trouve l'executable */ #ifdef __UNIX__ /* Sous LINUX ptarg[0] ne donne pas le chemin complet de l'executable, * il faut le retrouver par la commande "which <filename> si aucun * chemin n'est donne */ #ifdef __APPLE__ // Derive path from location of the app bundle CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle == NULL) return false; CFURLRef urlref = CFBundleCopyBundleURL(mainBundle); if (urlref == NULL) return false; CFStringRef str = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle); if (str == NULL) return false; char *native_str = NULL; int len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8) + 1; native_str = new char[len]; CFStringGetCString(str, native_str, len, kCFStringEncodingUTF8); m_BinDir = CONV_FROM_UTF8(native_str); delete[] native_str; #elif defined(__UNIX__) // Under Linux, if argv[0] doesn't the complete path to the executable, // it's necessary to obtain it using "which <filename>". FILE* ftmp; #define TMP_FILE "/tmp/kicad.tmp" Loading @@ -223,7 +232,7 @@ bool WinEDA_App::SetBinDir() FileName[0] = 0; str_arg0 = argv[0]; if( strchr( (const char*) argv[0], '/' ) == NULL ) /* pas de chemin */ if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path { sprintf( FileName, "which %s > %s", CONV_TO_UTF8( str_arg0 ), TMP_FILE ); ii = system( FileName ); Loading
common/gestfich.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -464,19 +464,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para wxString FullFileName; #ifdef __WXMAC__ // Mac part wxGetEnv( "HOME", &FullFileName ); FullFileName += wxString( "/bin/" ) + ExecFile; if( !wxFileExists( FullFileName ) ) { FullFileName = FindKicadFile( ExecFile ); } #else FullFileName = FindKicadFile( ExecFile ); #endif if( wxFileExists( FullFileName ) ) { Loading