From 90049a5fd368df71219c9280fbdc9315cf53fcbe Mon Sep 17 00:00:00 2001 From: d0k3 Date: Mon, 29 May 2017 01:50:35 +0200 Subject: [PATCH] CXI/NDS Dumper: Create output dir if it doesn't exist Fixes #76 --- source/game/gameutil.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/game/gameutil.c b/source/game/gameutil.c index eb3d25d..994a4a7 100644 --- a/source/game/gameutil.c +++ b/source/game/gameutil.c @@ -1384,6 +1384,11 @@ u32 DumpCxiSrlFromTmdFile(const char* path) { // prepare output name snprintf(dest, 256, OUTPUT_PATH "/"); char* dname = dest + strnlen(dest, 256); + + // ensure the output dir exists + // warning: this will only build output dirs in the root dir (!!!) + if ((f_stat(OUTPUT_PATH, NULL) != FR_OK) && (f_mkdir(OUTPUT_PATH) != FR_OK)) + return 1; // get path to CXI/SRL and decrypt (if encrypted) if ((strncmp(path + 1, ":/title/", 8) != 0) ||