move an operation to the beginning of the loop so we don't have to have it twice

This commit is contained in:
Tomsic, Jason 2018-07-06 08:04:01 -04:00
commit 03fdd19b3a

View file

@ -1938,6 +1938,9 @@ int fix_attributes(char *path, u32 *total, u32 is_root, u32 check_first_run)
dirLength = strlen(path); dirLength = strlen(path);
for (;;) for (;;)
{ {
// Clear file or folder path.
path[dirLength] = 0;
// Read a directory item. // Read a directory item.
res = f_readdir(&dir, &fno); res = f_readdir(&dir, &fno);
@ -1947,10 +1950,7 @@ int fix_attributes(char *path, u32 *total, u32 is_root, u32 check_first_run)
// Skip official Nintendo dir. // Skip official Nintendo dir.
if (is_root && !strcmp(fno.fname, "Nintendo")) if (is_root && !strcmp(fno.fname, "Nintendo"))
{
path[dirLength] = 0;
continue; continue;
}
// Set new directory or file. // Set new directory or file.
memcpy(&path[dirLength], "/", 1); memcpy(&path[dirLength], "/", 1);
@ -1972,9 +1972,6 @@ int fix_attributes(char *path, u32 *total, u32 is_root, u32 check_first_run)
if (res != FR_OK) if (res != FR_OK)
break; break;
} }
// Clear file or folder path.
path[dirLength] = 0;
} }
f_closedir(&dir); f_closedir(&dir);