From 4d5097b41d812a99755c9f64f0ae0030db4e8153 Mon Sep 17 00:00:00 2001 From: Cirilo Bernardo Date: Fri, 15 Jan 2016 14:01:21 +1100 Subject: [PATCH] Work in progress: preparing new resolver scheme --- 3d-viewer/3d_cache/3d_filename_resolver.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/3d-viewer/3d_cache/3d_filename_resolver.cpp b/3d-viewer/3d_cache/3d_filename_resolver.cpp index d64a302037..f904a12932 100644 --- a/3d-viewer/3d_cache/3d_filename_resolver.cpp +++ b/3d-viewer/3d_cache/3d_filename_resolver.cpp @@ -224,6 +224,9 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName ) tname.Replace( wxT( "/" ), wxT( "\\" ) ); #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 ) ) { wxFileName tmp( tname ); @@ -233,8 +236,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName ) m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) ); - std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n"; - return tname; } @@ -252,13 +253,9 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName ) tname = tmp.GetFullPath(); m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) ); - std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n"; - return tname; } - std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n"; - // XXX - no such path - consider showing the user a pop-up message 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 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 { 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 ) ); - std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n"; - return tname; } } while( 0 ); @@ -294,8 +291,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName ) if( !SplitAlias( aFileName, alias, relpath ) ) { - std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n"; - // XXX - no such path - consider showing the user a pop-up message return wxEmptyString; } @@ -316,8 +311,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName ) m_NameMap.insert( std::pair< wxString, wxString > ( aFileName, tname ) ); - std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n"; - return tname; } } @@ -325,8 +318,6 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName ) ++sPL; } - std::cerr << "XXX: RESOLVER LINE " << __LINE__ << "\n"; - // XXX - no such path - consider showing the user a pop-up message wxString errmsg = _( "filename could not be resolved" ); std::cerr << " * [3D Model] " << errmsg.ToUTF8() << " '";