- When switching nands now the whole path is shown at the top not just the current folder name. If it's too long the first folder(s) get truncated off the display.

This commit is contained in:
fledge68 2013-07-14 14:16:25 +00:00
parent bc759934cb
commit eceea9a423

View File

@ -404,11 +404,20 @@ string CMenu::_FolderExplorer(void)
if(folderName.find_last_of("/") == string::npos) if(folderName.find_last_of("/") == string::npos)
folderName = ""; folderName = "";
else else
{
if(folderName.find_first_of("/") != folderName.find_last_of("/"))
{ {
folderName = folderName.erase(folderName.find_last_of("/")); folderName = folderName.erase(folderName.find_last_of("/"));
//if its more than just device and :/ then erase up to last foldername while(folderName.length() > 32)
if(folderName.find_last_of("/") != string::npos) {
folderName = folderName.erase(0, folderName.find_last_of("/")+1); if(folderName.find_first_of("/") == string::npos)
break;
folderName = folderName.erase(0, folderName.find_first_of("/")+1);
}
if(folderName.find_first_of(":") == string::npos)
folderName = "/"+folderName;
folderName = folderName+"/";
}
} }
//if we removed device then clear path completely //if we removed device then clear path completely
if(strchr(dir, '/') == NULL) if(strchr(dir, '/') == NULL)
@ -438,10 +447,18 @@ string CMenu::_FolderExplorer(void)
else if(!fsop_FileExist(fmt("%s%s", dir, entries_char[i-2]))) else if(!fsop_FileExist(fmt("%s%s", dir, entries_char[i-2])))
{ {
strcat(dir, entries_char[i-2]); strcat(dir, entries_char[i-2]);
folderName = entries_char[i-2]; folderName = dir;
/* otherwise it fails */ while(folderName.length() > 32)
{
//this if won't happen the first time
if(folderName.find_first_of("/") == string::npos)
break;
folderName = folderName.erase(0, folderName.find_first_of("/")+1);
}
if(folderName.find_first_of(":") == string::npos)
folderName = "/"+folderName;
folderName = folderName+"/";
strcat(dir, "/"); strcat(dir, "/");
//gprintf("Directory path =%s\n", dir);
_refreshFolderExplorer(); _refreshFolderExplorer();
} }
} }