Fix resolution of paths relative to KISYS3DMOD in legacy support

This commit is contained in:
Cirilo Bernardo 2016-01-19 10:30:20 +11:00
parent 625ce3cb69
commit d3f68e6482
1 changed files with 22 additions and 2 deletions

View File

@ -274,12 +274,32 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
}
} while( 0 );
++sPL;
++sPL; // skip to item 2: KISYS3DMOD
// check if the path is relative to KISYS3DMOD but lacking
// the "KISYS3DMOD:" alias tag
if( !sPL->m_pathexp.empty() )
{
wxFileName fpath( wxFileName::DirName( sPL->m_pathexp ) );
wxString fullPath = fpath.GetPathWithSep() + tname;
if( wxFileName::FileExists( fullPath ) )
{
wxFileName tmp( fullPath );
if( tmp.Normalize() )
tname = tmp.GetFullPath();
m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) );
return tname;
}
}
wxString alias; // the alias portion of the short filename
wxString relpath; // the path relative to the alias
if( !SplitAlias( aFileName, alias, relpath ) )
if( !SplitAlias( tname, alias, relpath ) )
{
// XXX - no such path - consider showing the user a pop-up message
return wxEmptyString;