Fix filename resolution within VRML2 Inline{}

This commit is contained in:
Cirilo Bernardo 2016-04-03 10:55:22 +10:00
parent 978268250e
commit 2dfd8064d4
3 changed files with 11 additions and 2 deletions

View File

@ -133,6 +133,13 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
wxFileName fn; wxFileName fn;
fn.Assign( tname ); fn.Assign( tname );
if( fn.IsRelative() && !m_dir.empty() )
{
wxString fname = wxString::FromUTF8Unchecked( m_dir.c_str() );
fname.append( tname );
fn.Assign( fname );
}
if( !fn.Normalize() ) if( !fn.Normalize() )
{ {
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) ); m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) );
@ -200,6 +207,7 @@ bool WRL2BASE::Read( WRLPROC& proc )
} }
WRL2NODE* node = NULL; WRL2NODE* node = NULL;
m_dir = proc.GetParentDir();
while( ReadNode( proc, this, &node ) && !proc.eof() ); while( ReadNode( proc, this, &node ) && !proc.eof() );

View File

@ -60,6 +60,7 @@ class WRL2BASE : public WRL2NODE
{ {
private: private:
bool m_useInline; bool m_useInline;
std::string m_dir; // parent directory of the file
// handle cases of USE / DEF // handle cases of USE / DEF
bool implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ); bool implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode );

View File

@ -45,8 +45,8 @@
#define PLUGIN_VRML_MAJOR 1 #define PLUGIN_VRML_MAJOR 1
#define PLUGIN_VRML_MINOR 3 #define PLUGIN_VRML_MINOR 3
#define PLUGIN_VRML_PATCH 0 #define PLUGIN_VRML_PATCH 1
#define PLUGIN_VRML_REVNO 1 #define PLUGIN_VRML_REVNO 0
const char* GetKicadPluginName( void ) const char* GetKicadPluginName( void )