summaryrefslogtreecommitdiffstats
path: root/gui/fileselector.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2016-01-28 20:52:16 +0100
committerDees Troy <dees_troy@teamw.in>2016-01-29 18:03:56 +0100
commitc12a7f0f62ef66845554b46b5a2baea05a7ea327 (patch)
tree555592f53d42c211b57581f49cca8ae21442cf28 /gui/fileselector.cpp
parentFix minuitwrp include mistake (diff)
downloadandroid_bootable_recovery-c12a7f0f62ef66845554b46b5a2baea05a7ea327.tar
android_bootable_recovery-c12a7f0f62ef66845554b46b5a2baea05a7ea327.tar.gz
android_bootable_recovery-c12a7f0f62ef66845554b46b5a2baea05a7ea327.tar.bz2
android_bootable_recovery-c12a7f0f62ef66845554b46b5a2baea05a7ea327.tar.lz
android_bootable_recovery-c12a7f0f62ef66845554b46b5a2baea05a7ea327.tar.xz
android_bootable_recovery-c12a7f0f62ef66845554b46b5a2baea05a7ea327.tar.zst
android_bootable_recovery-c12a7f0f62ef66845554b46b5a2baea05a7ea327.zip
Diffstat (limited to 'gui/fileselector.cpp')
-rw-r--r--gui/fileselector.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index 23f235c75..9275d976d 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -31,8 +31,6 @@ extern "C" {
#include "../data.hpp"
#include "../twrp-functions.hpp"
-#define TW_FILESELECTOR_UP_A_LEVEL "(Up A Level)"
-
int GUIFileSelector::mSortOrder = 0;
GUIFileSelector::GUIFileSelector(xml_node<>* node) : GUIScrollList(node)
@@ -186,9 +184,9 @@ bool GUIFileSelector::fileSort(FileData d1, FileData d2)
return -1;
if (d2.fileName == ".")
return 0;
- if (d1.fileName == TW_FILESELECTOR_UP_A_LEVEL)
+ if (d1.fileName == "..")
return -1;
- if (d2.fileName == TW_FILESELECTOR_UP_A_LEVEL)
+ if (d2.fileName == "..")
return 0;
switch (mSortOrder) {
@@ -251,12 +249,8 @@ int GUIFileSelector::GetFileList(const std::string folder)
continue;
if (data.fileName == ".." && folder == "/")
continue;
- if (data.fileName == "..") {
- data.fileName = TW_FILESELECTOR_UP_A_LEVEL;
- data.fileType = DT_DIR;
- } else {
- data.fileType = de->d_type;
- }
+
+ data.fileType = de->d_type;
std::string path = folder + "/" + data.fileName;
stat(path.c_str(), &st);
@@ -272,7 +266,7 @@ int GUIFileSelector::GetFileList(const std::string folder)
data.fileType = TWFunc::Get_D_Type_From_Stat(path);
}
if (data.fileType == DT_DIR) {
- if (mShowNavFolders || (data.fileName != "." && data.fileName != TW_FILESELECTOR_UP_A_LEVEL))
+ if (mShowNavFolders || (data.fileName != "." && data.fileName != ".."))
mFolderList.push_back(data);
} else if (data.fileType == DT_REG || data.fileType == DT_LNK || data.fileType == DT_BLK) {
if (mExtn.empty() || (data.fileName.length() > mExtn.length() && data.fileName.substr(data.fileName.length() - mExtn.length()) == mExtn)) {
@@ -319,6 +313,8 @@ void GUIFileSelector::RenderItem(size_t itemindex, int yPos, bool selected)
if (itemindex < folderSize) {
text = mFolderList.at(itemindex).fileName;
icon = mFolderIcon;
+ if (text == "..")
+ text = gui_lookup("up_a_level", "(Up A Level)");
} else {
text = mFileList.at(itemindex - folderSize).fileName;
icon = mFileIcon;
@@ -345,7 +341,7 @@ void GUIFileSelector::NotifySelect(size_t item_selected)
// Ignore requests to do nothing
if (str == ".") return;
- if (str == TW_FILESELECTOR_UP_A_LEVEL) {
+ if (str == "..") {
if (cwd != "/") {
size_t found;
found = cwd.find_last_of('/');