35#include <wx/filename.h>
40namespace fs = std::filesystem;
46 fs::path temp = fs::temp_directory_path() /
"fnres_test";
47 fs::create_directories( temp );
49 fs::path work = temp /
"work";
50 fs::create_directories( work );
52 fs::path file = work /
"model.txt";
53 std::ofstream( file.string() ) <<
"dummy";
57 wxString absFile = wxString::FromUTF8( file.string() );
59 wxFileName fn( absFile );
60 fn.Normalize( wxPATH_NORM_ABSOLUTE | wxPATH_NORM_DOTS );
63 wxString working = wxString::FromUTF8( work.string() );
70 fs::path temp = fs::temp_directory_path() /
"fnres_alias";
71 fs::create_directories( temp );
73 fs::path file = temp /
"a.txt";
74 std::ofstream( file.string() ) <<
"dummy";
80 sp.
m_Pathvar = wxString::FromUTF8( temp.string() );
81 std::vector<SEARCH_PATH> paths = { sp };
88 BOOST_CHECK( missing.IsEmpty() );
97 fs::path root = fs::temp_directory_path() /
"ss_root";
98 fs::path sub = root /
"sub";
99 fs::create_directories( sub );
101 fs::path file = sub /
"f.txt";
102 std::ofstream( file.string() ) <<
"dummy";
105 stack.
AddPaths( wxString::FromUTF8( root.string() ) );
108 wxString::FromUTF8( root.string() ) );
109 BOOST_CHECK_EQUAL( rel, wxString::FromUTF8( ( fs::path(
"sub" ) /
"f.txt" ).
string() ) );
111 fs::path outside = fs::temp_directory_path() /
"outside.txt";
112 std::ofstream( outside.string() ) <<
"dummy";
115 wxString::FromUTF8( root.string() ) );
Provide an extensible class to resolve 3D model paths.
wxString ResolvePath(const wxString &aFileName, const wxString &aWorkingPath, std::vector< const EMBEDDED_FILES * > aEmbeddedFilesStack)
Determine the full path of the given file name.
bool UpdatePathList(const std::vector< SEARCH_PATH > &aPathList)
Clear the current path list and substitutes the given path list and update the path configuration fil...
Look for files in a number of paths.
void AddPaths(const wxString &aPaths, int aIndex=-1)
Insert or append path(s).
wxString FilenameWithRelativePathInSearchList(const wxString &aFullFilename, const wxString &aBaseDir)
Return the shortest possible path which can be use later to find a full path from this SEARCH_STACK.
static FILENAME_RESOLVER * resolver
wxString m_Pathvar
Base path as stored in the configuration file.
wxString m_Alias
Alias to the base path.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK_EQUAL(ret, c.m_exp_result)
BOOST_AUTO_TEST_CASE(ResolveAbsoluteAndWorkingPath)
BOOST_AUTO_TEST_SUITE_END()