strips the path from a file name
| 316 | |
| 317 | // strips the path from a file name |
| 318 | string 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 |
nothing calls this directly
no outgoing calls
no test coverage detected