MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / StripPath

Function StripPath

core/platform.cpp:318–347  ·  view source on GitHub ↗

strips the path from a file name

Source from the content-addressed store, hash-verified

316
317// strips the path from a file name
318string StripPath(const char* path)
319{
320 // simply find the last
321 const char* iter=path;
322 const char* last=NULL;
323 while (*iter)
324 {
325 if (*iter == '\\' || *iter== '/')
326 last = iter;
327
328 ++iter;
329 }
330
331 if (!last)
332 {
333 return string(path);
334 }
335
336 // eat the last slash
337 ++last;
338
339 if (*last)
340 {
341 return string(last);
342 }
343 else
344 {
345 return string();
346 }
347}
348

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected