MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / SetFilePath

Method SetFilePath

framework/src/util/SharedLibrary.cpp:198–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 }
197
198 void
199 SharedLibrary::SetFilePath(std::string const& absoluteFilePath)
200 {
201 if (IsLoaded())
202 return;
203
204 d->m_FilePath = absoluteFilePath;
205
206 std::string name = d->m_FilePath;
207 std::size_t pos = d->m_FilePath.find_last_of(util::DIR_SEP);
208 if (pos != std::string::npos)
209 {
210 d->m_Path = d->m_FilePath.substr(0, pos);
211 name = d->m_FilePath.substr(pos + 1);
212 }
213 else
214 {
215 d->m_Path.clear();
216 }
217
218 if (name.size() >= d->m_Prefix.size() && name.compare(0, d->m_Prefix.size(), d->m_Prefix) == 0)
219 {
220 name = name.substr(d->m_Prefix.size());
221 }
222 if (name.size() >= d->m_Suffix.size()
223 && name.compare(name.size() - d->m_Suffix.size(), d->m_Suffix.size(), d->m_Suffix) == 0)
224 {
225 name = name.substr(0, name.size() - d->m_Suffix.size());
226 }
227 d->m_Name = name;
228 }
229
230 std::string
231 SharedLibrary::GetFilePath() const

Callers 1

TESTFunction · 0.80

Calls 3

compareMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64