From b613044f8919126106bcddd7089c890a1ce4fe26 Mon Sep 17 00:00:00 2001 From: Sorgelig Date: Thu, 7 Sep 2023 23:16:45 +0800 Subject: [PATCH] MGL: support for absolute paths. --- menu.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/menu.cpp b/menu.cpp index b339bc1..3c12579 100644 --- a/menu.cpp +++ b/menu.cpp @@ -2383,7 +2383,11 @@ void HandleUI(void) case MENU_GENERIC_FILE_SELECTED: { - if (!mgl->done) snprintf(selPath, sizeof(selPath), "%s/%s", HomeDir(), mgl->item[mgl->current].path); + if (!mgl->done) + { + if(mgl->item[mgl->current].path[0] == '/') snprintf(selPath, sizeof(selPath), "%s", mgl->item[mgl->current].path); + else snprintf(selPath, sizeof(selPath), "%s/%s", HomeDir(), mgl->item[mgl->current].path); + } MenuHide(); printf("File selected: %s\n", selPath); @@ -2434,7 +2438,11 @@ void HandleUI(void) case MENU_GENERIC_IMAGE_SELECTED: { - if (!mgl->done) snprintf(selPath, sizeof(selPath), "%s/%s", HomeDir(((is_pce() && !strncasecmp(fs_pFileExt, "CUE", 3)) ? PCECD_DIR : NULL)), mgl->item[mgl->current].path); + if (!mgl->done) + { + if (mgl->item[mgl->current].path[0] == '/') snprintf(selPath, sizeof(selPath), "%s", mgl->item[mgl->current].path); + else snprintf(selPath, sizeof(selPath), "%s/%s", HomeDir(((is_pce() && !strncasecmp(fs_pFileExt, "CUE", 3)) ? PCECD_DIR : NULL)), mgl->item[mgl->current].path); + } if (store_name) {