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

Method SetFilePath

Modules/CppMicroServices/src/usSharedLibrary.cpp:181–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181void SharedLibrary::SetFilePath(const std::string& absoluteFilePath)
182{
183 if (IsLoaded()) return;
184
185 d.Detach();
186 d->m_FilePath = absoluteFilePath;
187
188 std::string name = d->m_FilePath;
189 std::size_t pos = d->m_FilePath.find_last_of(PATH_SEPARATOR);
190 if (pos != std::string::npos)
191 {
192 d->m_Path = d->m_FilePath.substr(0, pos);
193 name = d->m_FilePath.substr(pos+1);
194 }
195 else
196 {
197 d->m_Path.clear();
198 }
199
200 if (name.size() >= d->m_Prefix.size() &&
201 name.compare(0, d->m_Prefix.size(), d->m_Prefix) == 0)
202 {
203 name = name.substr(d->m_Prefix.size());
204 }
205 if (name.size() >= d->m_Suffix.size() &&
206 name.compare(name.size()-d->m_Suffix.size(), d->m_Suffix.size(), d->m_Suffix) == 0)
207 {
208 name = name.substr(0, name.size()-d->m_Suffix.size());
209 }
210 d->m_Name = name;
211}
212
213std::string SharedLibrary::GetFilePath() const
214{

Callers 1

usSharedLibraryTestFunction · 0.80

Calls 3

DetachMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by 1

usSharedLibraryTestFunction · 0.64