41
42
#include <build_version.h>
45
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
46
static void set_lib_env_var( const wxString& aAbsoluteArgv0 )
48
// POLICY CHOICE 2: Keep same path, so that installer MAY put the
49
// "subsidiary DSOs" in the same directory as the kiway top process modules.
50
// A subsidiary shared library is one that is not a top level DSO, but rather
51
// some shared library that a top level DSO needs to even be loaded. It is
52
// a static link to a shared object from a top level DSO.
54
// This directory POLICY CHOICE 2 is not the only dir in play, since LIB_ENV_VAR
55
// has numerous path options in it, as does DSO searching on linux, windows, and OSX.
56
// See "man ldconfig" on linux. What's being done here is for quick installs
57
// into a non-standard place, and especially for Windows users who may not
58
// know what the PATH environment variable is or how to set it.
60
wxFileName fn( aAbsoluteArgv0 );
62
wxString ld_path( LIB_ENV_VAR );
63
wxString my_path = fn.GetPath();
64
wxString new_paths = PrePendPath( ld_path, my_path );
66
wxSetEnv( ld_path, new_paths );
71
wxGetEnv( ld_path, &test );
72
printf( "LIB_ENV_VAR:'%s'\n", TO_UTF8( test ) );
43
78
// a dummy to quiet linking with EDA_BASE_FRAME::config();
44
79
#include <kiface_i.h>
47
wxASSERT( 0 ); // should never be called, only reference is from EDA_BASE_FRAME::config();
82
// This function should never be called. It is only referenced from
83
// EDA_BASE_FRAME::config() and this is only provided to satisfy the linker,
84
// not to be actually called.
85
wxLogFatalError( wxT( "Unexpected call to Kiface() in kicad/kicad.cpp" ) );
48
87
return (KIFACE_I&) *(KIFACE_I*) 0;
74
// Set LIB_ENV_VAR *before* loading the DSO, in case the top-level DSO holding the
75
// KIFACE has hard dependencies on subsidiary DSOs below it.
76
SetLibEnvVar( absoluteArgv0 );
112
// Set LIB_ENV_VAR *before* loading the KIFACE DSOs, in case they have hard
113
// dependencies on subsidiary DSOs below it.
114
set_lib_env_var( absoluteArgv0 );
119
// Add search paths to feed the PGM_KICAD::SysSearch() function,
120
// currenly limited in support to only look for project templates
124
SystemDirsAppend( &bases );
126
// DBG( bases.Show( (std::string(__func__) + " bases").c_str() );)
128
for( unsigned i = 0; i < bases.GetCount(); ++i )
130
wxFileName fn( bases[i], wxEmptyString );
132
// Add KiCad template file path to search path list.
133
fn.AppendDir( wxT( "template" ) );
134
m_bm.m_search.AddPaths( fn.GetPath() );
137
//DBG( m_bm.m_search.Show( (std::string( __func__ ) + " SysSearch()").c_str() );)
82
140
// Read current setup and reopen last directory if no filename to open on
84
142
if( App().argc == 1 )
202
* is a container for all KIWAYS [and PROJECTS]. This class needs to work both
203
* for a C++ project manager and an a wxPython one (after being moved into a
212
bool OnStart( wxApp* aProcess );
216
KIWAY& operator[]( int aIndex )
218
wxASSERT( m_kiways.size() ); // stuffed in OnStart()
219
return m_kiways[aIndex];
224
// KIWAYs may not be moved once doled out, since window DNA depends on the
225
// pointer being good forever.
226
// boost_ptr::vector however never moves the object pointed to.
227
typedef boost::ptr_vector<KIWAY> KIWAYS;
232
static KIWAY_MGR kiways;
262
KIWAY Kiway( &Pgm(), KFCTL_CPP_PROJECT_SUITE );
250
280
int OnExit() // overload wxApp virtual
254
284
Pgm().OnPgmExit();
256
286
return wxApp::OnExit();
289
int OnRun() // overload wxApp virtual
293
return wxApp::OnRun();
295
catch( const std::exception& e )
297
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
298
GetChars( FROM_UTF8( typeid(e).name() )),
299
GetChars( FROM_UTF8( e.what() ) ) );;
301
catch( const IO_ERROR& ioe )
303
wxLogError( GetChars( ioe.errorText ) );
307
wxLogError( wxT( "Unhandled exception of unknown type" ) );
260
314
* Function MacOpenFile
261
315
* is specific to MacOSX (not used under Linux or Windows).