| 499 | } |
| 500 | |
| 501 | FORGE_TOOL_API void fsGetPathFileName(const char* path, char* output) |
| 502 | { |
| 503 | const size_t pathLength = strlen(path); |
| 504 | ASSERT(pathLength != 0); |
| 505 | |
| 506 | char parentPath[FS_MAX_PATH] = { 0 }; |
| 507 | fsGetParentPath(path, parentPath); |
| 508 | size_t parentPathLength = strlen(parentPath); |
| 509 | |
| 510 | if (parentPathLength < pathLength && (isDirectorySeparator(path[parentPathLength]))) |
| 511 | { |
| 512 | parentPathLength += 1; |
| 513 | } |
| 514 | |
| 515 | char extension[FS_MAX_PATH] = { 0 }; |
| 516 | fsGetPathExtension(path, extension); |
| 517 | |
| 518 | // Include dot in the length |
| 519 | const size_t extensionLength = extension[0] != 0 ? strlen(extension) + 1 : 0; |
| 520 | |
| 521 | const size_t outputLength = pathLength - parentPathLength - extensionLength; |
| 522 | strncpy(output, path + parentPathLength, outputLength); |
| 523 | output[outputLength] = '\0'; |
| 524 | } |
| 525 | |
| 526 | /************************************************************************/ |
| 527 | // MARK: - File iteration |
no test coverage detected