243 |
return result; |
return result; |
244 |
} |
} |
245 |
|
|
246 |
|
std::string Path::getName(std::string path) { |
247 |
|
Path p; |
248 |
|
#if WIN32 |
249 |
|
p.fromWindows(path); |
250 |
|
#else |
251 |
|
p.fromPosix(path); |
252 |
|
#endif |
253 |
|
|
254 |
|
return p.getName(); |
255 |
|
} |
256 |
|
|
257 |
|
std::string Path::getName() { |
258 |
|
if(elements.empty()) return ""; |
259 |
|
return elements[elements.size() - 1]; |
260 |
|
} |
261 |
|
|
262 |
|
std::string Path::getBaseName(std::string path) { |
263 |
|
Path p; |
264 |
|
#if WIN32 |
265 |
|
p = fromWindows(path); |
266 |
|
#else |
267 |
|
p = fromPosix(path); |
268 |
|
#endif |
269 |
|
|
270 |
|
return p.getBaseName(); |
271 |
|
} |
272 |
|
|
273 |
|
std::string Path::getBaseName() { |
274 |
|
std::string name = getName(); |
275 |
|
size_t lastdot = name.find_last_of('.'); |
276 |
|
if(lastdot == std::string::npos) return name; |
277 |
|
return name.substr(0, lastdot); |
278 |
|
} |
279 |
|
|
280 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |