From d3f68e6482773c485237a944a797232bb2f7f8d1 Mon Sep 17 00:00:00 2001 From: Cirilo Bernardo Date: Tue, 19 Jan 2016 10:30:20 +1100 Subject: [PATCH] Fix resolution of paths relative to KISYS3DMOD in legacy support --- 3d-viewer/3d_cache/3d_filename_resolver.cpp | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/3d-viewer/3d_cache/3d_filename_resolver.cpp b/3d-viewer/3d_cache/3d_filename_resolver.cpp index c731598839..445f0ef462 100644 --- a/3d-viewer/3d_cache/3d_filename_resolver.cpp +++ b/3d-viewer/3d_cache/3d_filename_resolver.cpp @@ -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;