diff options
Diffstat (limited to 'gui/fileselector.cpp')
-rw-r--r-- | gui/fileselector.cpp | 20 |
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('/'); |