Default path fixes and remove old to find 3D model path code.
* Fix default KISYSMOD/KISYS3DMOD (#ifdef typo) for OSX builds. * Remove setting KIGITHUB from kicad/pcbnew Info.plist in favor of hardcoded default setting for OSX builds. * Remove now unneeded Set3DShapesDefaultPath() and other small things.
This commit is contained in:
parent
10d67ffbd9
commit
30acc07e11
|
@ -64,7 +64,7 @@
|
||||||
/// The install prefix used for KiCad's libraries.
|
/// The install prefix used for KiCad's libraries.
|
||||||
/// These paths are only intended to be reasonable default values that work if
|
/// These paths are only intended to be reasonable default values that work if
|
||||||
/// the user installs KiCad in the default path for a given platform.
|
/// the user installs KiCad in the default path for a given platform.
|
||||||
#if defined( APPLE )
|
#if defined( __APPLE__ )
|
||||||
#define KICAD_DATA_PATH "/Library/Application Support/kicad"
|
#define KICAD_DATA_PATH "/Library/Application Support/kicad"
|
||||||
#else
|
#else
|
||||||
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"
|
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"
|
||||||
|
|
|
@ -35,137 +35,6 @@
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* attempts to set the environment variable given by aKiSys3Dmod to a valid path.
|
|
||||||
* (typically "KISYS3DMOD" )
|
|
||||||
* If the environment variable is already set, then it left as is to respect
|
|
||||||
* the wishes of the user.
|
|
||||||
*
|
|
||||||
* The path is determined by attempting to find the path modules/packages3d
|
|
||||||
* files in kicad tree.
|
|
||||||
* This may or may not be the best path but it provides the best solution for
|
|
||||||
* backwards compatibility with the previous 3D shapes search path implementation.
|
|
||||||
*
|
|
||||||
* @note This must be called after #SetBinDir() is called at least on Windows.
|
|
||||||
* Otherwise, the kicad path is not known (Windows specific)
|
|
||||||
*
|
|
||||||
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
|
|
||||||
* @param aProcess = the current process
|
|
||||||
* @return false if the aKiSys3Dmod path is not valid.
|
|
||||||
*/
|
|
||||||
bool Set3DShapesDefaultPath( const wxString& aKiSys3Dmod, const PGM_BASE* aProcess )
|
|
||||||
{
|
|
||||||
wxString path;
|
|
||||||
|
|
||||||
// Set the KISYS3DMOD environment variable for the current process,
|
|
||||||
// if it is not already defined in the user's environment and valid.
|
|
||||||
if( wxGetEnv( aKiSys3Dmod, &path ) && wxFileName::DirExists( path ) )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Try to find a valid path is standard KiCad paths
|
|
||||||
SEARCH_STACK& search = Kiface().KifaceSearch();
|
|
||||||
path = search.FindValidPath( LIB3D_FOLDER );
|
|
||||||
|
|
||||||
if( !path.IsEmpty() )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Attempt to determine where the 3D shape libraries were installed using the
|
|
||||||
// legacy path:
|
|
||||||
// on Unix: /usr/local/kicad/share/modules/packages3d
|
|
||||||
// oor /usr/local/kicad/share/kicad/modules/packages3d
|
|
||||||
// or /usr/share/kicad/modules/packages3d
|
|
||||||
// On Windows: bin../share/modules/packages3d
|
|
||||||
wxString relpath( wxT( "modules/" ) );
|
|
||||||
relpath += LIB3D_FOLDER;
|
|
||||||
|
|
||||||
// Apple MacOSx
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
path = wxT("/Library/Application Support/kicad/modules/packages3d/");
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
path = wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT("/Library/Application Support/kicad/modules/packages3d/");
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__UNIX__) // Linux and non-Apple Unix
|
|
||||||
// Try the home directory:
|
|
||||||
path.Empty();
|
|
||||||
wxGetEnv( wxT("HOME"), &path );
|
|
||||||
path += wxT("/kicad/share/") + relpath;
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
path.Empty();
|
|
||||||
wxGetEnv( wxT("HOME"), &path );
|
|
||||||
path += wxT("/kicad/share/kicad/") + relpath;
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try the standard install path:
|
|
||||||
path = wxT("/usr/local/kicad/share/") + relpath;
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try the new standard install path:
|
|
||||||
path = wxT("/usr/local/kicad/share/kicad/") + relpath;
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Try the official distrib standard install path:
|
|
||||||
path = wxT("/usr/share/kicad/") + relpath;
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // Windows
|
|
||||||
// On Windows, the install path is given by the path of executables
|
|
||||||
wxFileName fn;
|
|
||||||
fn.AssignDir( aProcess->GetExecutablePath() );
|
|
||||||
fn.RemoveLastDir();
|
|
||||||
path = fn.GetPathWithSep() + wxT("share/") + relpath;
|
|
||||||
|
|
||||||
if( wxFileName::DirExists( path ) )
|
|
||||||
{
|
|
||||||
wxSetEnv( aKiSys3Dmod, path );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
|
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,11 +181,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||||
|
|
||||||
start_common( aCtlBits );
|
start_common( aCtlBits );
|
||||||
|
|
||||||
// Set 3D shape path (environment variable KISYS3DMOD (if not defined or valid)
|
|
||||||
// Currently, called here, but could be moved ( OpenProjectFiles() ? )
|
|
||||||
// if KISYS3DMOD is defined in a project config file
|
|
||||||
Set3DShapesDefaultPath( KISYS3DMOD, aProgram );
|
|
||||||
|
|
||||||
/* Now that there are no *.mod files in the standard library, this function
|
/* Now that there are no *.mod files in the standard library, this function
|
||||||
has no utility. User should simply set the variable manually.
|
has no utility. User should simply set the variable manually.
|
||||||
Looking for *.mod files which do not exist is fruitless.
|
Looking for *.mod files which do not exist is fruitless.
|
||||||
|
|
|
@ -30,26 +30,6 @@
|
||||||
|
|
||||||
class PGM_BASE;
|
class PGM_BASE;
|
||||||
|
|
||||||
/**
|
|
||||||
* attempts to set (when not set or valid) the environment variable given by aKiSys3Dmod
|
|
||||||
* (typically "KISYS3DMOD" ) to a valid path.
|
|
||||||
* If the environment variable is already set, then it left as is to respect
|
|
||||||
* the wishes of the user.
|
|
||||||
*
|
|
||||||
* The path is determined by attempting to find the path modules/packages3d
|
|
||||||
* files in kicad tree.
|
|
||||||
* This may or may not be the best path but it provides the best solution for
|
|
||||||
* backwards compatibility with the previous 3D shapes search path implementation.
|
|
||||||
*
|
|
||||||
* @note This must be called after #SetBinDir() is called at least on Windows.
|
|
||||||
* Otherwise, the kicad path is not known (Windows specific)
|
|
||||||
*
|
|
||||||
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
|
|
||||||
* @param aProcess = the current process
|
|
||||||
* @return false if the aKiSys3Dmod path is not valid.
|
|
||||||
*/
|
|
||||||
bool Set3DShapesDefaultPath( const wxString& aKiSys3Dmod, const PGM_BASE* aProcess );
|
|
||||||
|
|
||||||
|
|
||||||
/// Utility for comma separated lists
|
/// Utility for comma separated lists
|
||||||
inline void AccumulateDescription( wxString &aDesc, const wxString &aItem )
|
inline void AccumulateDescription( wxString &aDesc, const wxString &aItem )
|
||||||
|
|
|
@ -30,9 +30,5 @@
|
||||||
<key>LSRequiresCarbon</key> <true/>
|
<key>LSRequiresCarbon</key> <true/>
|
||||||
<key>NSHumanReadableCopyright</key> <string></string>
|
<key>NSHumanReadableCopyright</key> <string></string>
|
||||||
<key>NSHighResolutionCapable</key> <string>True</string>
|
<key>NSHighResolutionCapable</key> <string>True</string>
|
||||||
<key>LSEnvironment</key>
|
|
||||||
<dict>
|
|
||||||
<key>KIGITHUB</key> <string>https://github.com/kicad</string>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -33,9 +33,5 @@
|
||||||
<key>LSRequiresCarbon</key> <true/>
|
<key>LSRequiresCarbon</key> <true/>
|
||||||
<key>NSHumanReadableCopyright</key> <string></string>
|
<key>NSHumanReadableCopyright</key> <string></string>
|
||||||
<key>NSHighResolutionCapable</key> <string>True</string>
|
<key>NSHighResolutionCapable</key> <string>True</string>
|
||||||
<key>LSEnvironment</key>
|
|
||||||
<dict>
|
|
||||||
<key>KIGITHUB</key> <string>https://github.com/kicad</string>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -760,7 +760,6 @@ private:
|
||||||
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
|
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
|
||||||
// This special environment variable is used to locate 3d shapes
|
// This special environment variable is used to locate 3d shapes
|
||||||
unique.insert( KISYS3DMOD );
|
unique.insert( KISYS3DMOD );
|
||||||
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
|
|
||||||
|
|
||||||
m_path_subs_grid->AppendRows( unique.size() );
|
m_path_subs_grid->AppendRows( unique.size() );
|
||||||
|
|
||||||
|
|
|
@ -309,11 +309,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||||
// display the real hotkeys in menus or tool tips
|
// display the real hotkeys in menus or tool tips
|
||||||
ReadHotkeyConfig( wxT( "PcbFrame" ), g_Board_Editor_Hokeys_Descr );
|
ReadHotkeyConfig( wxT( "PcbFrame" ), g_Board_Editor_Hokeys_Descr );
|
||||||
|
|
||||||
// Set 3D shape path (environment variable KISYS3DMOD) if not defined or valid
|
|
||||||
// Currently, called here, but could be moved ( OpenProjectFiles() ? )
|
|
||||||
// if KISYS3DMOD is defined in a project config file
|
|
||||||
Set3DShapesDefaultPath( KISYS3DMOD, aProgram );
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// The global table is not related to a specific project. All projects
|
// The global table is not related to a specific project. All projects
|
||||||
|
|
Loading…
Reference in New Issue