Fix zero file bug in mkllfs

This commit is contained in:
L-diy
2023-11-16 16:03:36 +01:00
parent 96bc57fc3c
commit b2b5076af1

View File

@@ -1,7 +1,7 @@
/**
* @file main.c
* @brief Converts files to a C file that can be used by llfs (linked list file system).
* @version 0.2.0
* @version 0.2.1
* @author Lorenz C.
*/
@@ -10,7 +10,7 @@
#include <string.h>
#include "tinydir.h"
#define VERSION "0.2.0"
#define VERSION "0.2.1"
#define LLFS_VERSION "0.1.1"
#define MAX_PATH_LEN 256
@@ -125,7 +125,7 @@ int main(int argc, char** argv) {
// Make the last file the root file of the llfs
fprintf(out_file, "\n");
fprintf(out_file, "const struct llfs_data_file *llfs_root = &%s;\n", prev_llfs_name);
fprintf(out_file, "const struct llfs_data_file *llfs_root =%s%s;\n", (strcmp(prev_llfs_name, "NULL") == 0 ? " " : " &"), prev_llfs_name);
// Print the number of files
printf("Successfully converted %d files.\r\n", file_count);