Fix OSX help search paths.

This commit is contained in:
Adam Wolf 2015-02-06 16:13:35 -05:00 committed by Wayne Stambaugh
parent 7dadeadbf3
commit 88ce5920b5
1 changed files with 27 additions and 10 deletions

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 CERN * Copyright (C) 2014-2015 CERN
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -31,7 +31,7 @@
* Function FindFileInSearchPaths * Function FindFileInSearchPaths
* looks in "this" for \a aFilename, but first modifies every search * looks in "this" for \a aFilename, but first modifies every search
* path by appending a list of path fragments from aSubdirs. That modification * path by appending a list of path fragments from aSubdirs. That modification
* is not rentative. * is not relative.
*/ */
wxString FindFileInSearchPaths( const SEARCH_STACK& aStack, wxString FindFileInSearchPaths( const SEARCH_STACK& aStack,
const wxString& aFilename, const wxArrayString* aSubdirs ) const wxString& aFilename, const wxArrayString* aSubdirs )
@ -73,7 +73,12 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB
// If there's a KICAD environment variable set, use that guy's path also // If there's a KICAD environment variable set, use that guy's path also
ss.AddPaths( Pgm().GetKicadEnvVariable(), 0 ); ss.AddPaths( Pgm().GetKicadEnvVariable(), 0 );
#if 1 // && defined(__linux__) #if defined(__WXMAC__)
ss.AddPaths( GetOSXKicadMachineDataDir() );
ss.AddPaths( Pgm().GetExecutablePath(), 0 );
#endif
#if ! defined(__WXMAC__) // && defined(__linux__)
// Based on kicad-doc.bzr/CMakeLists.txt, line 20, the help files are // Based on kicad-doc.bzr/CMakeLists.txt, line 20, the help files are
// installed into "<CMAKE_INSTALL_PREFIX>/share/doc/kicad/help" for linux. // installed into "<CMAKE_INSTALL_PREFIX>/share/doc/kicad/help" for linux.
// This is ${KICAD_HELP} var in that CMakeLists.txt file. // This is ${KICAD_HELP} var in that CMakeLists.txt file.
@ -84,7 +89,7 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB
subdirs.Add( wxT( "help" ) ); subdirs.Add( wxT( "help" ) );
#endif #endif
#if 1 // && defined(__WINDOWS__) #if ! defined(__WXMAC__) // && defined(__WINDOWS__)
// Based on kicad-doc.bzr/CMakeLists.txt, line 35, the help files are // Based on kicad-doc.bzr/CMakeLists.txt, line 35, the help files are
// installed into "<CMAKE_INSTALL_PREFIX>/doc/help" for Windows. // installed into "<CMAKE_INSTALL_PREFIX>/doc/help" for Windows.
// This is ${KICAD_HELP} var in that CMakeLists.txt file. // This is ${KICAD_HELP} var in that CMakeLists.txt file.
@ -93,6 +98,18 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB
altsubdirs.Add( wxT( "help" ) ); altsubdirs.Add( wxT( "help" ) );
#endif #endif
#if defined (__WXMAC__)
// OS X packages can have the help files in
// /Library/Application\ Support/kicad/help,
// and in Contents/SharedSupport/help inside the
// bundle.
// Below we account for an international subdirectory.
subdirs.Add( wxT( "help" ) );
altsubdirs.Add( wxT( "Contents" ) );
altsubdirs.Add( wxT( "SharedSupport" ) );
altsubdirs.Add( wxT( "help" ) );
#endif
/* Search for a help file. /* Search for a help file.
* we *must* find a help file. * we *must* find a help file.
* so help is searched in directories in this order: * so help is searched in directories in this order: