MCPcopy Create free account
hub / github.com/Kitware/VTK / SetBaseDirectory

Method SetBaseDirectory

IO/Core/vtkURILoader.cxx:89–113  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

87
88//------------------------------------------------------------------------------
89bool vtkURILoader::SetBaseDirectory(const std::string& dirpath)
90{
91 if (!vtksys::SystemTools::FileExists(dirpath))
92 {
93 vtkErrorMacro("Can not find \"" << dirpath << "\"");
94 return false;
95 }
96
97 if (!vtksys::SystemTools::FileIsDirectory(dirpath))
98 {
99 vtkErrorMacro("\"" << dirpath << "\" is not a directory. Use SetBaseFileName.");
100 return false;
101 }
102
103 // add /. because relative URI truncate the last path component
104 auto fullPath = vtksys::SystemTools::CollapseFullPath(dirpath) + "/.";
105 if (fullPath.front() != '/') // add / for windows path
106 {
107 fullPath.insert(fullPath.begin(), '/');
108 }
109
110 this->Impl->BaseURI = vtkURI::Make("file", "", vtkURI::PercentEncode(fullPath));
111
112 return this->Impl->BaseURI;
113}
114
115//------------------------------------------------------------------------------
116vtkURI* vtkURILoader::GetBaseURI() const

Callers 2

TestFileLoadingFunction · 0.80
TryLoadGLTFModelFunction · 0.80

Calls 5

MakeFunction · 0.85
PercentEncodeFunction · 0.85
frontMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45

Tested by 1

TestFileLoadingFunction · 0.64