Commit 88ce5920 authored by Adam Wolf's avatar Adam Wolf Committed by Wayne Stambaugh
Browse files

Fix OSX help search paths.

parent 7dadeadb
Loading
Loading
Loading
Loading
+27 −10
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2014 CERN
 * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
 * Copyright (C) 2014-2015 CERN
 * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
 * @author Maciej Suminski <maciej.suminski@cern.ch>
 *
 * This program is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@
 * Function FindFileInSearchPaths
 * looks in "this" for \a aFilename, but first modifies every search
 * path by appending a list of path fragments from aSubdirs.  That modification
 * is not rentative.
 * is not relative.
 */
wxString FindFileInSearchPaths( const SEARCH_STACK& aStack,
        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
    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
    // installed into "<CMAKE_INSTALL_PREFIX>/share/doc/kicad/help" for linux.
    // 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" ) );
#endif

#if 1 // && defined(__WINDOWS__)
#if ! defined(__WXMAC__) // && defined(__WINDOWS__)
    // Based on kicad-doc.bzr/CMakeLists.txt, line 35, the help files are
    // installed into "<CMAKE_INSTALL_PREFIX>/doc/help" for Windows.
    // 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" ) );
#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.
     *  we *must* find a help file.
     *  so help is searched in directories in this order: