In menuScan(), don't add an extra '/' to the path when the cwd path already has it at the end, which happens with rootdir. This fixes rootdir support on 1.0.0. Added check for '/' in menuEntryLoad() for the dirlisting code which checks menuGetRootPath().
This commit is contained in:
parent
d2bb1da2fa
commit
8e8e62ac33
@ -183,7 +183,7 @@ static bool menuEntryLoadEmbeddedNacp(menuEntry_s* me) {
|
||||
}*/
|
||||
|
||||
bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) {
|
||||
int i=0;
|
||||
int i=0, tmplen;
|
||||
menu_s *menu_fileassoc = menuFileassocGetCurrent();
|
||||
menuEntry_s* fileassoc_me = NULL;
|
||||
char *strptr = NULL;
|
||||
@ -203,7 +203,8 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) {
|
||||
bool fileassoc_flag = 0;
|
||||
|
||||
//Use the first .nro found in the directory, if there's only 1 NRO in the directory. Only used for paths starting with "sdmc:/switch/".
|
||||
if (!found && strncmp(me->path, menuGetRootPath(), strlen(menuGetRootPath()))==0) {
|
||||
tmplen = strlen(menuGetRootPath());
|
||||
if (!found && strncmp(me->path, menuGetRootPath(), tmplen)==0 && me->path[tmplen]=='/') {
|
||||
DIR* dir;
|
||||
struct dirent* dp;
|
||||
u32 nro_count=0;
|
||||
|
@ -120,10 +120,22 @@ static void menuSort(void) {
|
||||
}
|
||||
|
||||
int menuScan(const char* target) {
|
||||
int pos;
|
||||
char dirsep[8];
|
||||
|
||||
if (chdir(target) < 0) return 1;
|
||||
if (getcwd(s_menu[!s_curMenu].dirname, PATH_MAX+1) == NULL)
|
||||
return 1;
|
||||
|
||||
memset(dirsep, 0, sizeof(dirsep));
|
||||
dirsep[0] = '/';
|
||||
|
||||
//While cwd will not have '/' at the end normally, it will have it when cwd is the root dir ("sdmc:/"). Don't add '/' to the path below when it's already present.
|
||||
pos = strlen(s_menu[!s_curMenu].dirname);
|
||||
if (pos > 0) {
|
||||
if (s_menu[!s_curMenu].dirname[pos-1] == '/') dirsep[0] = 0;
|
||||
}
|
||||
|
||||
DIR* dir;
|
||||
struct dirent* dp;
|
||||
char tmp_path[PATH_MAX+1];
|
||||
@ -140,7 +152,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", s_menu[!s_curMenu].dirname, dirsep, dp->d_name);
|
||||
|
||||
#ifdef __SWITCH__
|
||||
fsdev_dir_t* dirSt = (fsdev_dir_t*)dir->dirData->dirStruct;
|
||||
|
Loading…
Reference in New Issue
Block a user