Revert "IO: optimize createSubfolders (#1382)" (#1390)

This reverts commit 0284e4ccc4.
This commit is contained in:
Carter Li
2024-11-11 17:33:22 +08:00
committed by GitHub
parent 0a61031463
commit 4799f9277e
2 changed files with 7 additions and 10 deletions
+4 -5
View File
@@ -23,14 +23,13 @@
static void createSubfolders(const char* fileName)
{
char path[PATH_MAX];
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
char *token = NULL;
char *pathTail = path;
while((token = strchr(fileName, '/')) != NULL)
{
uint32_t length = (uint32_t)(token - fileName + 1);
pathTail = ffStrCopyN(pathTail, fileName, length);
mkdir(path, S_IRWXU | S_IRGRP | S_IROTH);
ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName);
mkdir(path.chars, S_IRWXU | S_IRGRP | S_IROTH);
fileName = token + 1;
}
}
+3 -5
View File
@@ -8,14 +8,12 @@
static void createSubfolders(const char* fileName)
{
char path[MAX_PATH];
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
char *token = NULL;
char *pathTail = path;
while((token = strchr(fileName, '/')) != NULL)
{
uint32_t length = (uint32_t)(token - fileName + 1);
pathTail = ffStrCopyN(pathTail, fileName, length);
CreateDirectoryA(path, NULL);
ffStrbufAppendNS(&path, (uint32_t)(token - fileName + 1), fileName);
CreateDirectoryA(path.chars, NULL);
fileName = token + 1;
}
}