MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / FileSystem_createDirectoryRecursive

Function FileSystem_createDirectoryRecursive

Tools/ToolsBootstrap.c:677–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675 len -= 4;
676 }
677 size_t start = 0;
678 if (len >= 3 && fileName[0] == 'S' && fileName[1] == 'C' && fileName[2] == '-') {
679 start = 3;
680 len -= 3;
681 }
682 if (len == 0) {
683 return String_duplicate("tool");
684 }
685 char* result = (char*)malloc(len + 1);
686 if (!result) return NULL;
687 memcpy(result, fileName + start, len);
688 result[len] = 0;
689 return result;
690}
691
692int isSCBuildDefinitionSource(const char* toolPath) {
693 const char* fileName = Path_fileName(toolPath);
694 return strcmp(fileName, "SC-build.cpp") == 0;
695}
696
697char* buildBuiltInToolSourcePath(const BootloaderArgs* args) {
698 char* toolCpp = Path_join(args->toolSourceDir, "SC-");
699 toolCpp = (char*)realloc(toolCpp, strlen(toolCpp) + strlen(args->toolName) + strlen(".cpp") + 1);
700 if (toolCpp) {
701 strcat(toolCpp, args->toolName);
702 strcat(toolCpp, ".cpp");
703 }
704 return toolCpp;
705}
706
707char* resolveToolSource(BootloaderArgs* args, int* builtInTool) {
708 *builtInTool = 1;
709
710 char* toolCpp = buildBuiltInToolSourcePath(args);
711 if (FileSystem_exists(toolCpp)) {
712 return toolCpp;
713 }
714
715 char* potentialCpp = String_duplicate(args->toolName);
716 if (FileSystem_exists(potentialCpp)) {
717 free(toolCpp);
718 *builtInTool = 0;
719
720 char* toolIdentity = deriveToolIdentity(potentialCpp);
721 if (!toolIdentity) {

Callers 4

setupCompilationFunction · 0.85
compilePOSIXFunction · 0.85
linkWindowsFunction · 0.85
compileWindowsFunction · 0.85

Calls 6

StringVector_initFunction · 0.85
Path_initFunction · 0.85
StringVector_addFunction · 0.85
FileSystem_isDirectoryFunction · 0.85
StringVector_destroyFunction · 0.85

Tested by

no test coverage detected