summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-01-28 16:09:37 +0100
committerGerrit Code Review <gerrit@5.9.244.119>2013-01-28 16:09:37 +0100
commit8005946bd2709a68867d897f5f6267e426b158aa (patch)
treeb956f5c09ec3d642c01e26a48bab53b46aed5a92
parentadding sideload page with wipe cache and dalvik (diff)
parentFix file manager displays empty list when folder is deleted (diff)
downloadandroid_bootable_recovery-8005946bd2709a68867d897f5f6267e426b158aa.tar
android_bootable_recovery-8005946bd2709a68867d897f5f6267e426b158aa.tar.gz
android_bootable_recovery-8005946bd2709a68867d897f5f6267e426b158aa.tar.bz2
android_bootable_recovery-8005946bd2709a68867d897f5f6267e426b158aa.tar.lz
android_bootable_recovery-8005946bd2709a68867d897f5f6267e426b158aa.tar.xz
android_bootable_recovery-8005946bd2709a68867d897f5f6267e426b158aa.tar.zst
android_bootable_recovery-8005946bd2709a68867d897f5f6267e426b158aa.zip
-rw-r--r--gui/fileselector.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index 7d896e670..aecdd253c 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -302,10 +302,7 @@ GUIFileSelector::GUIFileSelector(xml_node<>* node)
// Fetch the file/folder list
std::string value;
DataManager::GetValue(mPathVar, value);
- if (GetFileList(value) != 0 && (mShowNavFolders != 0 || mShowFiles != 0)) {
- GetFileList(DataManager::GetCurrentStoragePath());
- DataManager::SetValue(mPathVar, DataManager::GetCurrentStoragePath());
- }
+ GetFileList(value);
}
GUIFileSelector::~GUIFileSelector()
@@ -640,12 +637,7 @@ int GUIFileSelector::NotifyTouch(TOUCH_STATE state, int x, int y)
else
{
DataManager::SetValue(mPathVar, cwd);
- if (GetFileList(cwd) != 0)
- {
- LOGE("Unable to change folders.\n");
- DataManager::SetValue(mPathVar, oldcwd);
- GetFileList(oldcwd);
- }
+ GetFileList(cwd);
mStart = 0;
scrollingY = 0;
mUpdate = 1;
@@ -772,6 +764,17 @@ int GUIFileSelector::GetFileList(const std::string folder)
if (d == NULL)
{
LOGI("Unable to open '%s'\n", folder.c_str());
+ if (folder != "/" && (mShowNavFolders != 0 || mShowFiles != 0)) {
+ size_t found;
+ found = folder.find_last_of('/');
+ if (found != string::npos) {
+ string new_folder = folder.substr(0, found);
+
+ if (new_folder.length() < 2)
+ new_folder = "/";
+ DataManager::SetValue(mPathVar, new_folder);
+ }
+ }
return -1;
}
@@ -824,10 +827,7 @@ void GUIFileSelector::SetPageFocus(int inFocus)
{
std::string value;
DataManager::GetValue(mPathVar, value);
- if (GetFileList(value) != 0 && (mShowNavFolders != 0 || mShowFiles != 0)) {
- GetFileList(DataManager::GetCurrentStoragePath());
- DataManager::SetValue(mPathVar, DataManager::GetCurrentStoragePath());
- }
+ GetFileList(value);
}
}