MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / getRelativePath

Method getRelativePath

src/App/VRMLObject.cpp:99–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99std::string VRMLObject::getRelativePath(const std::string& prefix,
100 const std::string& resource) const
101{
102 std::string str;
103 std::string intname = this->getNameInDocument();
104 if (!prefix.empty()) {
105 if (resource.substr(0, prefix.size()) == prefix) {
106 std::string suffix = resource.substr(prefix.size());
107 str = intname + suffix;
108 }
109 }
110
111 if (str.empty()) {
112 Base::FileInfo fi(resource);
113 str = intname + "/" + fi.fileName();
114 }
115
116 return str;
117}
118
119std::string VRMLObject::fixRelativePath(const std::string& name, const std::string& resource)
120{

Callers

nothing calls this directly

Calls 5

substrMethod · 0.80
getNameInDocumentMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
fileNameMethod · 0.45

Tested by

no test coverage detected