PopDir now hightlights the folder you were in
This commit is contained in:
parent
a7cf8107d2
commit
93985e46c0
1 changed files with 37 additions and 11 deletions
|
@ -756,18 +756,44 @@ void FileBrowser::DisplayPNG()
|
||||||
|
|
||||||
void FileBrowser::PopFolder()
|
void FileBrowser::PopFolder()
|
||||||
{
|
{
|
||||||
|
char buffer[1024];
|
||||||
|
if (f_getcwd(buffer, 1024) == FR_OK)
|
||||||
|
{
|
||||||
|
// find the last '/' of the current dir
|
||||||
|
char *last_ptr = 0;
|
||||||
|
char *ptr = strtok(buffer, "/");
|
||||||
|
while (ptr != NULL)
|
||||||
|
{
|
||||||
|
last_ptr = ptr;
|
||||||
|
ptr = strtok(NULL, "/");
|
||||||
|
}
|
||||||
|
|
||||||
f_chdir("..");
|
f_chdir("..");
|
||||||
//{
|
|
||||||
// char buffer[1024];
|
|
||||||
// if (f_getcwd(buffer, 1024) == FR_OK)
|
|
||||||
// {
|
|
||||||
// DEBUG_LOG("CWD = %s\r\n", buffer);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
RefreshFolderEntries();
|
RefreshFolderEntries();
|
||||||
caddySelections.Clear();
|
caddySelections.Clear();
|
||||||
|
|
||||||
|
unsigned found=0;
|
||||||
|
if (last_ptr)
|
||||||
|
{
|
||||||
|
u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
||||||
|
for (unsigned i=0; i <= numberOfEntriesMinus1 ; i++)
|
||||||
|
{
|
||||||
|
FileBrowser::BrowsableList::Entry* entry = &folder.entries[i];
|
||||||
|
if (strcmp(last_ptr, entry->filImage.fname) == 0)
|
||||||
|
{
|
||||||
|
found=i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
folder.currentIndex=found;
|
||||||
|
folder.SetCurrent();
|
||||||
|
}
|
||||||
RefeshDisplay();
|
RefeshDisplay();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FileBrowser::UpdateCurrentHighlight()
|
void FileBrowser::UpdateCurrentHighlight()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue