From 9e47bf852a2274e779d51536a5118b89e42ab0b2 Mon Sep 17 00:00:00 2001 From: Rajko Stojadinovic Date: Sat, 7 Jul 2018 13:23:45 +0200 Subject: [PATCH 1/2] Fix NRO loading on 1.0.0 --- common/menu-list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/menu-list.c b/common/menu-list.c index ba7aacd..7e98819 100644 --- a/common/menu-list.c +++ b/common/menu-list.c @@ -104,7 +104,7 @@ int menuScan(const char* target) { bool entrytype=0; memset(tmp_path, 0, sizeof(tmp_path)); - snprintf(tmp_path, sizeof(tmp_path)-1, "%s/%s", s_menu[!s_curMenu].dirname, dp->d_name); + snprintf(tmp_path, sizeof(tmp_path)-1, "%s%s", s_menu[!s_curMenu].dirname, dp->d_name); #ifdef __SWITCH__ fsdev_dir_t* dirSt = (fsdev_dir_t*)dir->dirData->dirStruct; From 2dc72f971b1a9b4703b3f527af99a3105dfa990d Mon Sep 17 00:00:00 2001 From: Rajko Stojadinovic Date: Sat, 7 Jul 2018 13:51:19 +0200 Subject: [PATCH 2/2] Only add / when joining paths when necessary --- common/menu-list.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/menu-list.c b/common/menu-list.c index 7e98819..8f4295d 100644 --- a/common/menu-list.c +++ b/common/menu-list.c @@ -103,8 +103,13 @@ int menuScan(const char* target) { bool entrytype=0; - memset(tmp_path, 0, sizeof(tmp_path)); - snprintf(tmp_path, sizeof(tmp_path)-1, "%s%s", s_menu[!s_curMenu].dirname, dp->d_name); + size_t pathLen = strlen(s_menu[!s_curMenu].dirname); + strncpy(tmp_path, s_menu[!s_curMenu].dirname, sizeof(tmp_path)); + if (pathLen > 0 && tmp_path[pathLen-1] != '/') { + tmp_path[pathLen++] = '/'; + tmp_path[pathLen] = 0; + } + strncpy(&tmp_path[pathLen], dp->d_name, sizeof(tmp_path)-pathLen-1); #ifdef __SWITCH__ fsdev_dir_t* dirSt = (fsdev_dir_t*)dir->dirData->dirStruct;