mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Remember selected folder when pressing B (#180)
This commit is contained in:
parent
e7257819f5
commit
249f77b3bc
@ -695,15 +695,14 @@ std::string browseForFile (void) {
|
|||||||
|
|
||||||
if ((!(held & KEY_R) && (pressed & KEY_A))
|
if ((!(held & KEY_R) && (pressed & KEY_A))
|
||||||
|| (!entry->isDirectory && (held & KEY_R) && (pressed & KEY_A))) {
|
|| (!entry->isDirectory && (held & KEY_R) && (pressed & KEY_A))) {
|
||||||
if (entry->name == ".." && strcmp(path, getDrivePath()) == 0)
|
if (entry->name == ".." && strcmp(path, getDrivePath()) == 0) {
|
||||||
{
|
|
||||||
screenMode = 0;
|
screenMode = 0;
|
||||||
return "null";
|
return "null";
|
||||||
} else if (entry->isDirectory) {
|
} else if (entry->isDirectory) {
|
||||||
font->printf(firstCol, fileOffset - screenOffset + ENTRIES_START_ROW, true, alignStart, Palette::white, "%-*s", SCREEN_COLS - 5, STR_ENTERING_DIRECTORY.c_str(), alignStart);
|
font->printf(firstCol, fileOffset - screenOffset + ENTRIES_START_ROW, true, alignStart, Palette::white, "%-*s", SCREEN_COLS - 5, STR_ENTERING_DIRECTORY.c_str(), alignStart);
|
||||||
font->update(true);
|
font->update(true);
|
||||||
// Enter selected directory
|
// Enter selected directory
|
||||||
chdir (entry->name.c_str());
|
chdir(entry->name.c_str());
|
||||||
getDirectoryContents(dirContents);
|
getDirectoryContents(dirContents);
|
||||||
screenOffset = 0;
|
screenOffset = 0;
|
||||||
fileOffset = 0;
|
fileOffset = 0;
|
||||||
@ -742,10 +741,24 @@ std::string browseForFile (void) {
|
|||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
// Go up a directory
|
// Go up a directory
|
||||||
chdir ("..");
|
chdir("..");
|
||||||
getDirectoryContents (dirContents);
|
getDirectoryContents(dirContents);
|
||||||
screenOffset = 0;
|
screenOffset = 0;
|
||||||
fileOffset = 0;
|
fileOffset = 0;
|
||||||
|
|
||||||
|
// Return selection to where it was
|
||||||
|
char *trailingSlash = strrchr(path, '/');
|
||||||
|
*trailingSlash = '\0';
|
||||||
|
std::string dirName = strrchr(path, '/') + 1;
|
||||||
|
*trailingSlash = '/';
|
||||||
|
for(size_t i = 0; i < dirContents.size(); i++) {
|
||||||
|
if(dirContents[i].name == dirName) {
|
||||||
|
fileOffset = i;
|
||||||
|
if (fileOffset > screenOffset + ENTRIES_PER_SCREEN - 1)
|
||||||
|
screenOffset = fileOffset - ENTRIES_PER_SCREEN + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if ((held & KEY_R) && (pressed & KEY_X) && (entry->name != ".." && driveWritable(currentDrive))) { // Rename file/folder
|
} else if ((held & KEY_R) && (pressed & KEY_X) && (entry->name != ".." && driveWritable(currentDrive))) { // Rename file/folder
|
||||||
pressed = 0;
|
pressed = 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user