From 21f21da85d840e1c21f355c9f1f65f643c6ede7e Mon Sep 17 00:00:00 2001 From: "Tomsic, Jason" Date: Fri, 6 Jul 2018 08:00:19 -0400 Subject: [PATCH] add some comments --- ipl/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ipl/main.c b/ipl/main.c index 923e205..0ccf84e 100755 --- a/ipl/main.c +++ b/ipl/main.c @@ -1914,8 +1914,10 @@ int fix_attributes(char *path, u32 *total, u32 is_root, u32 check_first_run) u32 fileLength = 0; static FILINFO fno; + // Should we set the bit of the entry directory? if (check_first_run) { + // Read file attributes. res = f_stat(path, &fno); if (res != FR_OK) return res; @@ -1937,17 +1939,19 @@ int fix_attributes(char *path, u32 *total, u32 is_root, u32 check_first_run) { // Read a directory item. res = f_readdir(&dir, &fno); + // Break on error or end of dir. if (res != FR_OK || fno.fname[0] == 0) break; + // Skip official Nintendo dir. if (is_root && !strcmp(fno.fname, "Nintendo")) { path[dirLength] = 0; continue; } - // Set new directory. + // Set new directory or file. memcpy(&path[dirLength], "/", 1); fileLength = strlen(fno.fname); memcpy(&path[dirLength+1], fno.fname, fileLength + 1); @@ -1967,9 +1971,11 @@ int fix_attributes(char *path, u32 *total, u32 is_root, u32 check_first_run) if (res != FR_OK) break; } + // Clear file or folder path. path[dirLength] = 0; } + f_closedir(&dir); }