Loading common/edaappl.cpp +47 −21 Original line number Original line Diff line number Diff line Loading @@ -454,6 +454,7 @@ bool WinEDA_App::SetBinDir() return TRUE; return TRUE; } } /** /** * Set search paths for libraries, modules, internationalization files, etc. * Set search paths for libraries, modules, internationalization files, etc. */ */ Loading Loading @@ -721,7 +722,6 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id ) } } void WinEDA_App::SetLanguagePath( void ) void WinEDA_App::SetLanguagePath( void ) { { size_t i; size_t i; Loading @@ -734,6 +734,7 @@ void WinEDA_App::SetLanguagePath( void ) wxFileName fn( m_searchPaths[i], wxEmptyString ); wxFileName fn( m_searchPaths[i], wxEmptyString ); fn.AppendDir( wxT( "share" ) ); fn.AppendDir( wxT( "share" ) ); #ifndef __WXMSW__ #ifndef __WXMSW__ /* Up on level relative to binary path with "share/kicad" appended /* Up on level relative to binary path with "share/kicad" appended * for all other platforms. */ * for all other platforms. */ fn.AppendDir( wxT( "kicad" ) ); fn.AppendDir( wxT( "kicad" ) ); Loading Loading @@ -842,6 +843,10 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename, * for the current locale is not found, an attempt to find the English * for the current locale is not found, an attempt to find the English * version of the help file is made. wxEmptyString is returned if the * version of the help file is made. wxEmptyString is returned if the * help file is not found. * help file is not found. * Help file is searched in directories in this order: * help/<canonical name> like help/en_GB * help/<short name> like help/en * help/en */ */ wxString WinEDA_App::GetHelpFile( void ) wxString WinEDA_App::GetHelpFile( void ) { { Loading @@ -860,10 +865,29 @@ wxString WinEDA_App::GetHelpFile( void ) subdirs.Add( wxT( "kicad" ) ); subdirs.Add( wxT( "kicad" ) ); #endif #endif subdirs.Add( _T( "help" ) ); subdirs.Add( _T( "help" ) ); /* Search for a help file. * we *must* find a help file. * so help is searched in directories in this order: * help/<canonical name> like help/en_GB * help/<short name> like help/en * help/en */ // Step 1 : Try to find help file in help/<canonical name> subdirs.Add( m_Locale->GetCanonicalName() ); subdirs.Add( m_Locale->GetCanonicalName() ); fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); if( !fn && m_Locale->GetCanonicalName() != wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH )->CanonicalName ) // Step 2 : if not found Try to find help file in help/<short name> if( !fn ) { subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) ); // GetName( ) does not return always the short name fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); } // Step 3 : if not found Try to find help file in help/en if( !fn ) { { subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.Add( _T( "en" ) ); subdirs.Add( _T( "en" ) ); Loading @@ -873,12 +897,14 @@ wxString WinEDA_App::GetHelpFile( void ) return fn; return fn; } } wxString WinEDA_App::GetLibraryFile( const wxString& filename ) wxString WinEDA_App::GetLibraryFile( const wxString& filename ) { { wxArrayString subdirs; wxArrayString subdirs; subdirs.Add( wxT( "share" ) ); subdirs.Add( wxT( "share" ) ); #ifndef __WXMSW__ #ifndef __WXMSW__ /* Up on level relative to binary path with "share/kicad" appended for /* Up on level relative to binary path with "share/kicad" appended for * all other platforms. */ * all other platforms. */ subdirs.Add( wxT( "kicad" ) ); subdirs.Add( wxT( "kicad" ) ); Loading Loading
common/edaappl.cpp +47 −21 Original line number Original line Diff line number Diff line Loading @@ -454,6 +454,7 @@ bool WinEDA_App::SetBinDir() return TRUE; return TRUE; } } /** /** * Set search paths for libraries, modules, internationalization files, etc. * Set search paths for libraries, modules, internationalization files, etc. */ */ Loading Loading @@ -721,7 +722,6 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id ) } } void WinEDA_App::SetLanguagePath( void ) void WinEDA_App::SetLanguagePath( void ) { { size_t i; size_t i; Loading @@ -734,6 +734,7 @@ void WinEDA_App::SetLanguagePath( void ) wxFileName fn( m_searchPaths[i], wxEmptyString ); wxFileName fn( m_searchPaths[i], wxEmptyString ); fn.AppendDir( wxT( "share" ) ); fn.AppendDir( wxT( "share" ) ); #ifndef __WXMSW__ #ifndef __WXMSW__ /* Up on level relative to binary path with "share/kicad" appended /* Up on level relative to binary path with "share/kicad" appended * for all other platforms. */ * for all other platforms. */ fn.AppendDir( wxT( "kicad" ) ); fn.AppendDir( wxT( "kicad" ) ); Loading Loading @@ -842,6 +843,10 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename, * for the current locale is not found, an attempt to find the English * for the current locale is not found, an attempt to find the English * version of the help file is made. wxEmptyString is returned if the * version of the help file is made. wxEmptyString is returned if the * help file is not found. * help file is not found. * Help file is searched in directories in this order: * help/<canonical name> like help/en_GB * help/<short name> like help/en * help/en */ */ wxString WinEDA_App::GetHelpFile( void ) wxString WinEDA_App::GetHelpFile( void ) { { Loading @@ -860,10 +865,29 @@ wxString WinEDA_App::GetHelpFile( void ) subdirs.Add( wxT( "kicad" ) ); subdirs.Add( wxT( "kicad" ) ); #endif #endif subdirs.Add( _T( "help" ) ); subdirs.Add( _T( "help" ) ); /* Search for a help file. * we *must* find a help file. * so help is searched in directories in this order: * help/<canonical name> like help/en_GB * help/<short name> like help/en * help/en */ // Step 1 : Try to find help file in help/<canonical name> subdirs.Add( m_Locale->GetCanonicalName() ); subdirs.Add( m_Locale->GetCanonicalName() ); fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); if( !fn && m_Locale->GetCanonicalName() != wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH )->CanonicalName ) // Step 2 : if not found Try to find help file in help/<short name> if( !fn ) { subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) ); // GetName( ) does not return always the short name fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); } // Step 3 : if not found Try to find help file in help/en if( !fn ) { { subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.Add( _T( "en" ) ); subdirs.Add( _T( "en" ) ); Loading @@ -873,12 +897,14 @@ wxString WinEDA_App::GetHelpFile( void ) return fn; return fn; } } wxString WinEDA_App::GetLibraryFile( const wxString& filename ) wxString WinEDA_App::GetLibraryFile( const wxString& filename ) { { wxArrayString subdirs; wxArrayString subdirs; subdirs.Add( wxT( "share" ) ); subdirs.Add( wxT( "share" ) ); #ifndef __WXMSW__ #ifndef __WXMSW__ /* Up on level relative to binary path with "share/kicad" appended for /* Up on level relative to binary path with "share/kicad" appended for * all other platforms. */ * all other platforms. */ subdirs.Add( wxT( "kicad" ) ); subdirs.Add( wxT( "kicad" ) ); Loading