Loading CMakeLists.txt +40 −2 Original line number Original line Diff line number Diff line Loading @@ -349,8 +349,9 @@ if( APPLE ) set( OSX_BUNDLE_MAIN "kicad.app" ) set( OSX_BUNDLE_MAIN "kicad.app" ) set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" ) set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" ) set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" ) set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" ) set( OSX_BUNDLE_KIFACE_DIR "Contents/Plugins" ) set( OSX_BUNDLE_KIFACE_DIR "Contents/PlugIns" ) set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" ) set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" ) set( OSX_BUNDLE_APP_DIR "Contents/Applications" ) set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" ) set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" ) set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" ) set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" ) set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" ) set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" ) Loading @@ -377,6 +378,24 @@ if( APPLE ) # used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used # used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used # set it to correct value just in case (see common.cpp) # set it to correct value just in case (see common.cpp) set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" ) set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" ) # Override default paths for fixup_bundle set( OSX_BUNDLE_OVERRIDE_PATHS " function( gp_item_default_embedded_path_override item default_embedded_path_var ) # by default, embed things right next to the main bundle executable: set( path \"@executable_path/../../Contents/MacOS\" ) set( overridden 0 ) # embed .dylibs right next to the main bundle executable: if( item MATCHES \"\\\\.dylib$\" ) set( path \"@executable_path/../Frameworks\" ) set( overridden 1 ) endif() set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE ) endfunction(gp_item_default_embedded_path_override) " ) endif() endif() mark_as_advanced( KICAD_BIN mark_as_advanced( KICAD_BIN Loading Loading @@ -614,7 +633,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) ) ) else() else() # relative path for python in bundle # relative path for python in bundle set( PYTHON_LIB_DIR "python" ) set( PYTHON_LIB_DIR "python/site-packages" ) # install into bundle Frameworks folder # install into bundle Frameworks folder set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}" set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}" CACHE PATH "Python module install path." CACHE PATH "Python module install path." Loading Loading @@ -655,6 +674,25 @@ endif() # 'CMakeLists.txt' files to process # 'CMakeLists.txt' files to process #================================================ #================================================ if( APPLE ) # Remove app bundles in ${KICAD_BIN} before installing anything new. # Must be defined before all includes so that it is executed first. install( CODE " message( STATUS \"Removing existing application bundles...\" ) # Remove links to standalone apps file( REMOVE ${KICAD_BIN}/bitmap2component.app ) file( REMOVE ${KICAD_BIN}/eeschema.app ) file( REMOVE ${KICAD_BIN}/cvpcb.app ) file( REMOVE ${KICAD_BIN}/gerbview.app ) file( REMOVE ${KICAD_BIN}/pcb_calculator.app ) file( REMOVE ${KICAD_BIN}/pcbnew.app ) file( REMOVE ${KICAD_BIN}/pl_editor.app ) # Remove main bundle file( REMOVE_RECURSE ${KICAD_BIN}/${OSX_BUNDLE_MAIN} ) " COMPONENT Runtime ) endif() ############################ ############################ # Binaries ( CMake targets ) # # Binaries ( CMake targets ) # ############################ ############################ Loading Documentation/compiling/mac-osx.txt +2 −0 Original line number Original line Diff line number Diff line Loading @@ -100,6 +100,8 @@ target folder for compiled binaries, third parameter is the kicad folder, and the last optional parameter are make options used during the build (in this the last optional parameter are make options used during the build (in this case for building with 4 jobs in parallel). case for building with 4 jobs in parallel). The script will automatically detect if you are compiling wxWidgets or wxPython. The script will automatically detect if you are compiling wxWidgets or wxPython. NOTE: All paths are assumed to be relative to the current directory, i.e., the working root you are in. CAUTION: The script will erase existing wx-build and target folders (wx-bin) CAUTION: The script will erase existing wx-build and target folders (wx-bin) without any confirmation! without any confirmation! Loading common/gestfich.cpp +35 −20 Original line number Original line Diff line number Diff line Loading @@ -142,8 +142,11 @@ wxString FindKicadFile( const wxString& shortname ) { { // Test the presence of the file in the directory shortname of // Test the presence of the file in the directory shortname of // the KiCad binary path. // the KiCad binary path. #ifndef __WXMAC__ wxString fullFileName = Pgm().GetExecutablePath() + shortname; wxString fullFileName = Pgm().GetExecutablePath() + shortname; #else wxString fullFileName = Pgm().GetExecutablePath() + wxT( "Contents/MacOS/" ) + shortname; #endif if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) ) return fullFileName; return fullFileName; Loading @@ -157,16 +160,22 @@ wxString FindKicadFile( const wxString& shortname ) return fullFileName; return fullFileName; } } // find binary file from possibilities list: // /usr/local/kicad/linux or c:/kicad/winexe // Path list for KiCad binary files // Path list for KiCad binary files const static wxChar* possibilities[] = { const static wxChar* possibilities[] = { #ifdef __WINDOWS__ #if defined( __WINDOWS__ ) wxT( "c:/kicad/bin/" ), wxT( "c:/kicad/bin/" ), wxT( "d:/kicad/bin/" ), wxT( "d:/kicad/bin/" ), wxT( "c:/Program Files/kicad/bin/" ), wxT( "c:/Program Files/kicad/bin/" ), wxT( "d:/Program Files/kicad/bin/" ), wxT( "d:/Program Files/kicad/bin/" ), #elif defined( __WXMAC__ ) // all internal paths are relative to main bundle kicad.app wxT( "Contents/Applications/cvpcb.app/Contents/MacOS/" ), wxT( "Contents/Applications/pcbnew.app/Contents/MacOS/" ), wxT( "Contents/Applications/eeschema.app/Contents/MacOS/" ), wxT( "Contents/Applications/gerbview.app/Contents/MacOS/" ), wxT( "Contents/Applications/bitmap2component.app/Contents/MacOS/" ), wxT( "Contents/Applications/pcb_calculator.app/Contents/MacOS/" ), wxT( "Contents/Applications/pl_editor.app/Contents/MacOS/" ), #else #else wxT( "/usr/bin/" ), wxT( "/usr/bin/" ), wxT( "/usr/local/bin/" ), wxT( "/usr/local/bin/" ), Loading @@ -174,9 +183,15 @@ wxString FindKicadFile( const wxString& shortname ) #endif #endif }; }; // find binary file from possibilities list: for( unsigned i=0; i<DIM(possibilities); ++i ) for( unsigned i=0; i<DIM(possibilities); ++i ) { { #ifndef __WXMAC__ fullFileName = possibilities[i] + shortname; fullFileName = possibilities[i] + shortname; #else // make relative paths absolute fullFileName = Pgm().GetExecutablePath() + possibilities[i] + shortname; #endif if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) ) return fullFileName; return fullFileName; Loading @@ -189,31 +204,25 @@ wxString FindKicadFile( const wxString& shortname ) int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param, int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param, wxProcess *callback ) wxProcess *callback ) { { wxString fullFileName; wxString fullFileName = FindKicadFile( ExecFile ); fullFileName = FindKicadFile( ExecFile ); #ifdef __WXMAC__ if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) || wxDir::Exists( fullFileName ) ) { { return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" ) if( !param.IsEmpty() ) + ExecFile + wxT( " " ) fullFileName += wxT( " " ) + param; + param, wxEXEC_ASYNC, callback ); return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback ); } } #ifdef __WXMAC__ else else { return ProcessExecute( wxT( "/usr/bin/open " ) + param, wxEXEC_ASYNC, callback ); } #else if( wxFileExists( fullFileName ) ) { { if( !param.IsEmpty() ) if( !param.IsEmpty() ) fullFileName += wxT( " " ) + param; fullFileName += wxT( " " ) + param; return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback ); return ProcessExecute( wxT( "/usr/bin/open -a " ) + fullFileName, wxEXEC_ASYNC, callback ); } } #endif #endif wxString msg; wxString msg; msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) ); msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) ); DisplayError( frame, msg, 20 ); DisplayError( frame, msg, 20 ); Loading @@ -233,6 +242,7 @@ wxString KicadDatasPath() } } else // Path of executables. else // Path of executables. { { #ifndef __WXMAC__ wxString tmp = Pgm().GetExecutablePath(); wxString tmp = Pgm().GetExecutablePath(); #ifdef __WINDOWS__ #ifdef __WINDOWS__ tmp.MakeLower(); tmp.MakeLower(); Loading Loading @@ -303,6 +313,11 @@ wxString KicadDatasPath() break; break; } } } } #else // On OSX point to Contents/SharedSupport folder of main bundle data_path = GetOSXKicadDataDir(); found = true; #endif } } if( found ) if( found ) Loading common/kiway.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -113,11 +113,13 @@ const wxString KIWAY::dso_full_path( FACE_T aFaceId ) return wxEmptyString; return wxEmptyString; } } #ifndef __WXMAC__ wxFileName fn = wxStandardPaths::Get().GetExecutablePath(); wxFileName fn = wxStandardPaths::Get().GetExecutablePath(); #ifdef __WXMAC__ #else // we have the dso's in @executable_path/../Plugins in OSX bundle // we have the dso's in main OSX bundle kicad.app/Contents/PlugIns fn.RemoveLastDir(); wxFileName fn = Pgm().GetExecutablePath(); fn.AppendDir( wxT( "Plugins" ) ); fn.AppendDir( wxT( "Contents" ) ); fn.AppendDir( wxT( "PlugIns" ) ); #endif #endif fn.SetName( name ); fn.SetName( name ); Loading common/pgm_base.cpp +22 −29 Original line number Original line Diff line number Diff line Loading @@ -412,38 +412,30 @@ bool PGM_BASE::initPgm() bool PGM_BASE::setExecutablePath() bool PGM_BASE::setExecutablePath() { { #ifdef __APPLE__ // Apple MacOSx // 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_bin_dir = FROM_UTF8( native_str ); delete[] native_str; #else m_bin_dir = wxStandardPaths::Get().GetExecutablePath(); m_bin_dir = wxStandardPaths::Get().GetExecutablePath(); #endif #ifdef __WXMAC__ // On OSX Pgm().GetExecutablePath() will always point to main // bundle directory, e.g., /Applications/kicad.app/ wxFileName fn( m_bin_dir ); if( fn.GetName() == wxT( "kicad" ) ) { // kicad launcher, so just remove the Contents/MacOS part fn.RemoveLastDir(); fn.RemoveLastDir(); } else { // standalone binaries live in Contents/Applications/<standalone>.app/Contents/MacOS fn.RemoveLastDir(); fn.RemoveLastDir(); fn.RemoveLastDir(); fn.RemoveLastDir(); fn.RemoveLastDir(); } m_bin_dir = fn.GetPath() + wxT( "/" ); #else // Use unix notation for paths. I am not sure this is a good idea, // Use unix notation for paths. I am not sure this is a good idea, // but it simplifies compatibility between Windows and Unices. // but it simplifies compatibility between Windows and Unices. // However it is a potential problem in path handling under Windows. // However it is a potential problem in path handling under Windows. Loading @@ -452,6 +444,7 @@ bool PGM_BASE::setExecutablePath() // Remove file name form command line: // Remove file name form command line: while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() ) while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() ) m_bin_dir.RemoveLast(); m_bin_dir.RemoveLast(); #endif return true; return true; } } Loading Loading
CMakeLists.txt +40 −2 Original line number Original line Diff line number Diff line Loading @@ -349,8 +349,9 @@ if( APPLE ) set( OSX_BUNDLE_MAIN "kicad.app" ) set( OSX_BUNDLE_MAIN "kicad.app" ) set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" ) set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" ) set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" ) set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" ) set( OSX_BUNDLE_KIFACE_DIR "Contents/Plugins" ) set( OSX_BUNDLE_KIFACE_DIR "Contents/PlugIns" ) set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" ) set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" ) set( OSX_BUNDLE_APP_DIR "Contents/Applications" ) set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" ) set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" ) set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" ) set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" ) set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" ) set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" ) Loading @@ -377,6 +378,24 @@ if( APPLE ) # used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used # used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used # set it to correct value just in case (see common.cpp) # set it to correct value just in case (see common.cpp) set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" ) set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" ) # Override default paths for fixup_bundle set( OSX_BUNDLE_OVERRIDE_PATHS " function( gp_item_default_embedded_path_override item default_embedded_path_var ) # by default, embed things right next to the main bundle executable: set( path \"@executable_path/../../Contents/MacOS\" ) set( overridden 0 ) # embed .dylibs right next to the main bundle executable: if( item MATCHES \"\\\\.dylib$\" ) set( path \"@executable_path/../Frameworks\" ) set( overridden 1 ) endif() set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE ) endfunction(gp_item_default_embedded_path_override) " ) endif() endif() mark_as_advanced( KICAD_BIN mark_as_advanced( KICAD_BIN Loading Loading @@ -614,7 +633,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) ) ) else() else() # relative path for python in bundle # relative path for python in bundle set( PYTHON_LIB_DIR "python" ) set( PYTHON_LIB_DIR "python/site-packages" ) # install into bundle Frameworks folder # install into bundle Frameworks folder set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}" set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}" CACHE PATH "Python module install path." CACHE PATH "Python module install path." Loading Loading @@ -655,6 +674,25 @@ endif() # 'CMakeLists.txt' files to process # 'CMakeLists.txt' files to process #================================================ #================================================ if( APPLE ) # Remove app bundles in ${KICAD_BIN} before installing anything new. # Must be defined before all includes so that it is executed first. install( CODE " message( STATUS \"Removing existing application bundles...\" ) # Remove links to standalone apps file( REMOVE ${KICAD_BIN}/bitmap2component.app ) file( REMOVE ${KICAD_BIN}/eeschema.app ) file( REMOVE ${KICAD_BIN}/cvpcb.app ) file( REMOVE ${KICAD_BIN}/gerbview.app ) file( REMOVE ${KICAD_BIN}/pcb_calculator.app ) file( REMOVE ${KICAD_BIN}/pcbnew.app ) file( REMOVE ${KICAD_BIN}/pl_editor.app ) # Remove main bundle file( REMOVE_RECURSE ${KICAD_BIN}/${OSX_BUNDLE_MAIN} ) " COMPONENT Runtime ) endif() ############################ ############################ # Binaries ( CMake targets ) # # Binaries ( CMake targets ) # ############################ ############################ Loading
Documentation/compiling/mac-osx.txt +2 −0 Original line number Original line Diff line number Diff line Loading @@ -100,6 +100,8 @@ target folder for compiled binaries, third parameter is the kicad folder, and the last optional parameter are make options used during the build (in this the last optional parameter are make options used during the build (in this case for building with 4 jobs in parallel). case for building with 4 jobs in parallel). The script will automatically detect if you are compiling wxWidgets or wxPython. The script will automatically detect if you are compiling wxWidgets or wxPython. NOTE: All paths are assumed to be relative to the current directory, i.e., the working root you are in. CAUTION: The script will erase existing wx-build and target folders (wx-bin) CAUTION: The script will erase existing wx-build and target folders (wx-bin) without any confirmation! without any confirmation! Loading
common/gestfich.cpp +35 −20 Original line number Original line Diff line number Diff line Loading @@ -142,8 +142,11 @@ wxString FindKicadFile( const wxString& shortname ) { { // Test the presence of the file in the directory shortname of // Test the presence of the file in the directory shortname of // the KiCad binary path. // the KiCad binary path. #ifndef __WXMAC__ wxString fullFileName = Pgm().GetExecutablePath() + shortname; wxString fullFileName = Pgm().GetExecutablePath() + shortname; #else wxString fullFileName = Pgm().GetExecutablePath() + wxT( "Contents/MacOS/" ) + shortname; #endif if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) ) return fullFileName; return fullFileName; Loading @@ -157,16 +160,22 @@ wxString FindKicadFile( const wxString& shortname ) return fullFileName; return fullFileName; } } // find binary file from possibilities list: // /usr/local/kicad/linux or c:/kicad/winexe // Path list for KiCad binary files // Path list for KiCad binary files const static wxChar* possibilities[] = { const static wxChar* possibilities[] = { #ifdef __WINDOWS__ #if defined( __WINDOWS__ ) wxT( "c:/kicad/bin/" ), wxT( "c:/kicad/bin/" ), wxT( "d:/kicad/bin/" ), wxT( "d:/kicad/bin/" ), wxT( "c:/Program Files/kicad/bin/" ), wxT( "c:/Program Files/kicad/bin/" ), wxT( "d:/Program Files/kicad/bin/" ), wxT( "d:/Program Files/kicad/bin/" ), #elif defined( __WXMAC__ ) // all internal paths are relative to main bundle kicad.app wxT( "Contents/Applications/cvpcb.app/Contents/MacOS/" ), wxT( "Contents/Applications/pcbnew.app/Contents/MacOS/" ), wxT( "Contents/Applications/eeschema.app/Contents/MacOS/" ), wxT( "Contents/Applications/gerbview.app/Contents/MacOS/" ), wxT( "Contents/Applications/bitmap2component.app/Contents/MacOS/" ), wxT( "Contents/Applications/pcb_calculator.app/Contents/MacOS/" ), wxT( "Contents/Applications/pl_editor.app/Contents/MacOS/" ), #else #else wxT( "/usr/bin/" ), wxT( "/usr/bin/" ), wxT( "/usr/local/bin/" ), wxT( "/usr/local/bin/" ), Loading @@ -174,9 +183,15 @@ wxString FindKicadFile( const wxString& shortname ) #endif #endif }; }; // find binary file from possibilities list: for( unsigned i=0; i<DIM(possibilities); ++i ) for( unsigned i=0; i<DIM(possibilities); ++i ) { { #ifndef __WXMAC__ fullFileName = possibilities[i] + shortname; fullFileName = possibilities[i] + shortname; #else // make relative paths absolute fullFileName = Pgm().GetExecutablePath() + possibilities[i] + shortname; #endif if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) ) return fullFileName; return fullFileName; Loading @@ -189,31 +204,25 @@ wxString FindKicadFile( const wxString& shortname ) int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param, int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param, wxProcess *callback ) wxProcess *callback ) { { wxString fullFileName; wxString fullFileName = FindKicadFile( ExecFile ); fullFileName = FindKicadFile( ExecFile ); #ifdef __WXMAC__ if( wxFileExists( fullFileName ) ) if( wxFileExists( fullFileName ) || wxDir::Exists( fullFileName ) ) { { return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" ) if( !param.IsEmpty() ) + ExecFile + wxT( " " ) fullFileName += wxT( " " ) + param; + param, wxEXEC_ASYNC, callback ); return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback ); } } #ifdef __WXMAC__ else else { return ProcessExecute( wxT( "/usr/bin/open " ) + param, wxEXEC_ASYNC, callback ); } #else if( wxFileExists( fullFileName ) ) { { if( !param.IsEmpty() ) if( !param.IsEmpty() ) fullFileName += wxT( " " ) + param; fullFileName += wxT( " " ) + param; return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback ); return ProcessExecute( wxT( "/usr/bin/open -a " ) + fullFileName, wxEXEC_ASYNC, callback ); } } #endif #endif wxString msg; wxString msg; msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) ); msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) ); DisplayError( frame, msg, 20 ); DisplayError( frame, msg, 20 ); Loading @@ -233,6 +242,7 @@ wxString KicadDatasPath() } } else // Path of executables. else // Path of executables. { { #ifndef __WXMAC__ wxString tmp = Pgm().GetExecutablePath(); wxString tmp = Pgm().GetExecutablePath(); #ifdef __WINDOWS__ #ifdef __WINDOWS__ tmp.MakeLower(); tmp.MakeLower(); Loading Loading @@ -303,6 +313,11 @@ wxString KicadDatasPath() break; break; } } } } #else // On OSX point to Contents/SharedSupport folder of main bundle data_path = GetOSXKicadDataDir(); found = true; #endif } } if( found ) if( found ) Loading
common/kiway.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -113,11 +113,13 @@ const wxString KIWAY::dso_full_path( FACE_T aFaceId ) return wxEmptyString; return wxEmptyString; } } #ifndef __WXMAC__ wxFileName fn = wxStandardPaths::Get().GetExecutablePath(); wxFileName fn = wxStandardPaths::Get().GetExecutablePath(); #ifdef __WXMAC__ #else // we have the dso's in @executable_path/../Plugins in OSX bundle // we have the dso's in main OSX bundle kicad.app/Contents/PlugIns fn.RemoveLastDir(); wxFileName fn = Pgm().GetExecutablePath(); fn.AppendDir( wxT( "Plugins" ) ); fn.AppendDir( wxT( "Contents" ) ); fn.AppendDir( wxT( "PlugIns" ) ); #endif #endif fn.SetName( name ); fn.SetName( name ); Loading
common/pgm_base.cpp +22 −29 Original line number Original line Diff line number Diff line Loading @@ -412,38 +412,30 @@ bool PGM_BASE::initPgm() bool PGM_BASE::setExecutablePath() bool PGM_BASE::setExecutablePath() { { #ifdef __APPLE__ // Apple MacOSx // 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_bin_dir = FROM_UTF8( native_str ); delete[] native_str; #else m_bin_dir = wxStandardPaths::Get().GetExecutablePath(); m_bin_dir = wxStandardPaths::Get().GetExecutablePath(); #endif #ifdef __WXMAC__ // On OSX Pgm().GetExecutablePath() will always point to main // bundle directory, e.g., /Applications/kicad.app/ wxFileName fn( m_bin_dir ); if( fn.GetName() == wxT( "kicad" ) ) { // kicad launcher, so just remove the Contents/MacOS part fn.RemoveLastDir(); fn.RemoveLastDir(); } else { // standalone binaries live in Contents/Applications/<standalone>.app/Contents/MacOS fn.RemoveLastDir(); fn.RemoveLastDir(); fn.RemoveLastDir(); fn.RemoveLastDir(); fn.RemoveLastDir(); } m_bin_dir = fn.GetPath() + wxT( "/" ); #else // Use unix notation for paths. I am not sure this is a good idea, // Use unix notation for paths. I am not sure this is a good idea, // but it simplifies compatibility between Windows and Unices. // but it simplifies compatibility between Windows and Unices. // However it is a potential problem in path handling under Windows. // However it is a potential problem in path handling under Windows. Loading @@ -452,6 +444,7 @@ bool PGM_BASE::setExecutablePath() // Remove file name form command line: // Remove file name form command line: while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() ) while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() ) m_bin_dir.RemoveLast(); m_bin_dir.RemoveLast(); #endif return true; return true; } } Loading