mirror of
https://github.com/LumaTeam/Luma3DS.git
synced 2026-02-22 01:44:38 +00:00
Fix regression introduced by latest release
As it turns out, neither f_mkdir nor fs.c function create directories recursively, only the last one
This commit is contained in:
parent
856a4b3acf
commit
b4273f9569
@ -137,6 +137,7 @@ bool fileWrite(const void *buffer, const char *path, u32 size)
|
|||||||
return result == FR_OK && (u32)written == size;
|
return result == FR_OK && (u32)written == size;
|
||||||
}
|
}
|
||||||
case FR_NO_PATH:
|
case FR_NO_PATH:
|
||||||
|
// Only create the last dir in the hierarchy
|
||||||
for(u32 i = 1; path[i] != 0; i++)
|
for(u32 i = 1; path[i] != 0; i++)
|
||||||
if(path[i] == '/')
|
if(path[i] == '/')
|
||||||
{
|
{
|
||||||
@ -178,6 +179,7 @@ bool fileCopy(const char *pathSrc, const char *pathDst, bool replace, void *tmpB
|
|||||||
}
|
}
|
||||||
else if (res == FR_NO_PATH)
|
else if (res == FR_NO_PATH)
|
||||||
{
|
{
|
||||||
|
// Only create the last dir in the hierarchy
|
||||||
const char *c;
|
const char *c;
|
||||||
for (c = pathDst + strlen(pathDst); *c != '/' && c >= pathDst; --c);
|
for (c = pathDst + strlen(pathDst); *c != '/' && c >= pathDst; --c);
|
||||||
if (c >= pathDst && c - pathDst <= FF_MAX_LFN && *c != '\0')
|
if (c >= pathDst && c - pathDst <= FF_MAX_LFN && *c != '\0')
|
||||||
@ -446,6 +448,11 @@ static bool backupEssentialFiles(void)
|
|||||||
sprintf(pathStart, "backups/%08lX/", deviceID);
|
sprintf(pathStart, "backups/%08lX/", deviceID);
|
||||||
char fullPath[0x80];
|
char fullPath[0x80];
|
||||||
|
|
||||||
|
// Since the other funcs in this file don't create directories recursively (only the last one),
|
||||||
|
// and nor does f_mkdir, create the directories anyway and ignore the result
|
||||||
|
f_mkdir("backups");
|
||||||
|
f_mkdir(pathStart);
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
sprintf(fullPath, "%sHWCAL0.dat", pathStart);
|
sprintf(fullPath, "%sHWCAL0.dat", pathStart);
|
||||||
ok = ok && fileCopy("nand:/ro/sys/HWCAL0.dat", fullPath, false, fileCopyBuffer, sz);
|
ok = ok && fileCopy("nand:/ro/sys/HWCAL0.dat", fullPath, false, fileCopyBuffer, sz);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user