fixed problems in relative paths calculations for libs and docs files
This commit is contained in:
parent
51efe030e1
commit
6ebc2a52dd
|
@ -1013,26 +1013,21 @@ wxString WinEDA_App::ReturnFilenameWithRelativePathInLibPath( const wxString& aF
|
|||
*/
|
||||
wxFileName fn = aFullFilename;
|
||||
wxString filename = aFullFilename;
|
||||
int pathlen = -1; // path len, used to find the better subpath within defualts paths
|
||||
unsigned pathlen = fn.GetPath().Len(); /* path len, used to find the better (shortest) subpath
|
||||
* within defaults paths */
|
||||
|
||||
if( m_libSearchPaths.Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case
|
||||
filename = fn.GetName();
|
||||
else // not in the default, : see if this file is in a subpath:
|
||||
for( unsigned kk = 0; kk < m_libSearchPaths.GetCount(); kk++ )
|
||||
{
|
||||
filename = fn.GetPathWithSep() + fn.GetFullName();
|
||||
for( unsigned kk = 0; kk < m_libSearchPaths.GetCount(); kk++ )
|
||||
fn = aFullFilename;
|
||||
// Search for the shortest subpath within m_libSearchPaths:
|
||||
if( fn.MakeRelativeTo( m_libSearchPaths[kk] ) )
|
||||
{
|
||||
if( fn.MakeRelativeTo( m_libSearchPaths[kk] ) )
|
||||
if( fn.GetPathWithSep().StartsWith( wxT("..") ) ) // Path outside kicad libs paths
|
||||
continue;
|
||||
if( pathlen > fn.GetPath().Len() ) // A better (shortest) subpath is found
|
||||
{
|
||||
if( fn.GetPathWithSep().StartsWith( wxT("..") ) ) // Path outside kicad libs paths
|
||||
continue;
|
||||
if( pathlen < 0 // a first subpath is found
|
||||
|| pathlen > (int) fn.GetPath().Len() ) // or a better subpath if found
|
||||
{
|
||||
filename = fn.GetPathWithSep() + fn.GetFullName();
|
||||
pathlen = fn.GetPath().Len();
|
||||
}
|
||||
fn = aFullFilename; //Try to find a better subpath
|
||||
filename = fn.GetPathWithSep() + fn.GetFullName();
|
||||
pathlen = fn.GetPath().Len();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,11 +183,13 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
|
|||
|
||||
while( draw3D )
|
||||
{
|
||||
S3D_MASTER* draw3DCopy = new S3D_MASTER(NULL);
|
||||
draw3DCopy->Copy( draw3D );
|
||||
m_Shapes3D_list.push_back( draw3DCopy );
|
||||
m_3D_ShapeNameListBox->Append(draw3DCopy->m_Shape3DName);
|
||||
|
||||
if( !draw3D->m_Shape3DName.IsEmpty() )
|
||||
{
|
||||
S3D_MASTER* draw3DCopy = new S3D_MASTER(NULL);
|
||||
draw3DCopy->Copy( draw3D );
|
||||
m_Shapes3D_list.push_back( draw3DCopy );
|
||||
m_3D_ShapeNameListBox->Append(draw3DCopy->m_Shape3DName);
|
||||
}
|
||||
draw3D = (S3D_MASTER*) draw3D->Next();
|
||||
}
|
||||
|
||||
|
@ -297,7 +299,7 @@ void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
|
|||
TransfertDisplayTo3DValues( m_LastSelected3DShapeIndex );
|
||||
m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetSelection();
|
||||
|
||||
if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when deleting an item in m_3D_ShapeNameListBox wxListBox
|
||||
if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when deleting an item in m_3D_ShapeNameListBox wxListBox
|
||||
return;
|
||||
|
||||
if( m_LastSelected3DShapeIndex >= (int) m_Shapes3D_list.size() )
|
||||
|
|
|
@ -46,9 +46,9 @@ DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR()
|
|||
}
|
||||
|
||||
|
||||
/***************************************/
|
||||
/********************************************************/
|
||||
void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
|
||||
/***************************************/
|
||||
/********************************************************/
|
||||
{
|
||||
SetFocus();
|
||||
|
||||
|
@ -59,11 +59,13 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
|
|||
|
||||
while( draw3D )
|
||||
{
|
||||
S3D_MASTER* draw3DCopy = new S3D_MASTER(NULL);
|
||||
draw3DCopy->Copy( draw3D );
|
||||
m_Shapes3D_list.push_back( draw3DCopy );
|
||||
m_3D_ShapeNameListBox->Append(draw3DCopy->m_Shape3DName);
|
||||
|
||||
if( !draw3D->m_Shape3DName.IsEmpty() )
|
||||
{
|
||||
S3D_MASTER* draw3DCopy = new S3D_MASTER(NULL);
|
||||
draw3DCopy->Copy( draw3D );
|
||||
m_Shapes3D_list.push_back( draw3DCopy );
|
||||
m_3D_ShapeNameListBox->Append(draw3DCopy->m_Shape3DName);
|
||||
}
|
||||
draw3D = (S3D_MASTER*) draw3D->Next();
|
||||
}
|
||||
|
||||
|
@ -175,7 +177,7 @@ void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
|
|||
TransfertDisplayTo3DValues( m_LastSelected3DShapeIndex );
|
||||
m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetSelection();
|
||||
|
||||
if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when deleting an item in m_3D_ShapeNameListBox wxListBox
|
||||
if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when deleting an item in m_3D_ShapeNameListBox wxListBox
|
||||
return;
|
||||
|
||||
if( m_LastSelected3DShapeIndex >= (int)m_Shapes3D_list.size() )
|
||||
|
|
Loading…
Reference in New Issue