MCPcopy Create free account
hub / github.com/ConfettiFX/The-Forge / fsGetPathFileName

Function fsGetPathFileName

Common_3/Utilities/FileSystem/ToolFileSystem.c:501–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501FORGE_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

Callers 6

ProcessTexturesFunction · 0.85
ProcessTFXFunction · 0.85
CreateRuntimeAnimationsFunction · 0.85
ProcessGLTFFunction · 0.85
AssetPipelineCmdFunction · 0.85

Calls 3

fsGetParentPathFunction · 0.85
isDirectorySeparatorFunction · 0.85
fsGetPathExtensionFunction · 0.85

Tested by

no test coverage detected