mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
parent
e429f941be
commit
a7957f124a
@ -73,7 +73,6 @@ bool dirEntryPredicate (const DirEntry& lhs, const DirEntry& rhs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void getDirectoryContents (vector<DirEntry>& dirContents) {
|
void getDirectoryContents (vector<DirEntry>& dirContents) {
|
||||||
bool twoDotsMade = false;
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
@ -91,15 +90,7 @@ void getDirectoryContents (vector<DirEntry>& dirContents) {
|
|||||||
if(pent == NULL) break;
|
if(pent == NULL) break;
|
||||||
|
|
||||||
stat(pent->d_name, &st);
|
stat(pent->d_name, &st);
|
||||||
if (!twoDotsMade) {
|
if (strcmp(pent->d_name, "..") != 0) {
|
||||||
if (strcmp(pent->d_name, "..") != 0) {
|
|
||||||
dirEntry.name = "..";
|
|
||||||
dirEntry.isDirectory = true;
|
|
||||||
dirEntry.isApp = false;
|
|
||||||
dirContents.push_back (dirEntry); // List ".."
|
|
||||||
}
|
|
||||||
twoDotsMade = true;
|
|
||||||
} else if (strcmp(pent->d_name, "..") != 0) {
|
|
||||||
dirEntry.name = pent->d_name;
|
dirEntry.name = pent->d_name;
|
||||||
dirEntry.isDirectory = (st.st_mode & S_IFDIR) ? true : false;
|
dirEntry.isDirectory = (st.st_mode & S_IFDIR) ? true : false;
|
||||||
if (!dirEntry.isDirectory) {
|
if (!dirEntry.isDirectory) {
|
||||||
@ -130,6 +121,12 @@ void getDirectoryContents (vector<DirEntry>& dirContents) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort(dirContents.begin(), dirContents.end(), dirEntryPredicate);
|
sort(dirContents.begin(), dirContents.end(), dirEntryPredicate);
|
||||||
|
|
||||||
|
DirEntry dirEntry;
|
||||||
|
dirEntry.name = ".."; // ".." entry
|
||||||
|
dirEntry.isDirectory = true;
|
||||||
|
dirEntry.isApp = false;
|
||||||
|
dirContents.insert (dirContents.begin(), dirEntry); // Add ".." to top of list
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDirectoryContents (const vector<DirEntry>& dirContents, int fileOffset, int startRow) {
|
void showDirectoryContents (const vector<DirEntry>& dirContents, int fileOffset, int startRow) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user