void FL_CreatePath(const VStr& Path) { guard(FL_CreatePath); VStr Temp = Path; for (size_t i = 3; i <= Temp.Length(); i++) { if (Temp[i] == '/' || Temp[i] == '\\' || Temp[i] == 0) { char Save = Temp[i]; Temp[i] = 0; if (!Sys_DirExists(Temp)) Sys_CreateDirectory(Temp); Temp[i] = Save; } } unguard; }
void CreateDirectories(const char* path){ const char* cursor = path; const char* endPath = path+strlen(path); char subPath[512]; char* dst=subPath; while(1){ while (*cursor != '\\' && *cursor!= '/' && cursor != endPath) { *dst=*cursor; cursor++; dst++; } if (cursor >= endPath) return; *dst = 0; int error = Sys_CreateDirectory(subPath); if (error == -1){ printErrorMessage(errno,subPath); } else printf("Created folder: '%s'.\n",subPath); *dst=*cursor; cursor++; dst++; } }