Work in progress: preparing new resolver scheme

This commit is contained in:
Cirilo Bernardo 2016-01-15 14:01:21 +11:00
parent 2ed89c29d2
commit 4d5097b41d
1 changed files with 6 additions and 15 deletions

View File

@ -224,6 +224,9 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
tname.Replace( wxT( "/" ), wxT( "\\" ) ); tname.Replace( wxT( "/" ), wxT( "\\" ) );
#endif #endif
// this case covers full paths and paths relative to
// the current working directory (which is not necessarily
// the current project directory)
if( wxFileName::FileExists( tname ) ) if( wxFileName::FileExists( tname ) )
{ {
wxFileName tmp( tname ); wxFileName tmp( tname );
@ -233,8 +236,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) ); m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) );
std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n";
return tname; return tname;
} }
@ -252,13 +253,9 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
tname = tmp.GetFullPath(); tname = tmp.GetFullPath();
m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) ); m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) );
std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n";
return tname; return tname;
} }
std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n";
// XXX - no such path - consider showing the user a pop-up message // XXX - no such path - consider showing the user a pop-up message
return wxEmptyString; return wxEmptyString;
} }
@ -266,7 +263,9 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
std::list< S3D_ALIAS >::const_iterator sPL = m_Paths.begin(); std::list< S3D_ALIAS >::const_iterator sPL = m_Paths.begin();
std::list< S3D_ALIAS >::const_iterator ePL = m_Paths.end(); std::list< S3D_ALIAS >::const_iterator ePL = m_Paths.end();
// check the path relative to the current dir // check the path relative to the current project directory;
// note: this is not necessarily the same as the current working
// directory, which has already been checked
do do
{ {
wxFileName fpath( wxFileName::DirName( sPL->m_pathexp ) ); wxFileName fpath( wxFileName::DirName( sPL->m_pathexp ) );
@ -281,8 +280,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) ); m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) );
std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n";
return tname; return tname;
} }
} while( 0 ); } while( 0 );
@ -294,8 +291,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
if( !SplitAlias( aFileName, alias, relpath ) ) if( !SplitAlias( aFileName, alias, relpath ) )
{ {
std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n";
// XXX - no such path - consider showing the user a pop-up message // XXX - no such path - consider showing the user a pop-up message
return wxEmptyString; return wxEmptyString;
} }
@ -316,8 +311,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) ); m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) );
std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n";
return tname; return tname;
} }
} }
@ -325,8 +318,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
++sPL; ++sPL;
} }
std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n";
// XXX - no such path - consider showing the user a pop-up message // XXX - no such path - consider showing the user a pop-up message
wxString errmsg = _( "filename could not be resolved" ); wxString errmsg = _( "filename could not be resolved" );
std::cerr << " * [3D Model] " << errmsg.ToUTF8() << " '"; std::cerr << " * [3D Model] " << errmsg.ToUTF8() << " '";