mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Load file sizes into memory
This commit is contained in:
parent
cec3315ac1
commit
7a9fcbe092
@ -49,6 +49,7 @@ static char path[PATH_MAX];
|
|||||||
|
|
||||||
struct DirEntry {
|
struct DirEntry {
|
||||||
string name;
|
string name;
|
||||||
|
off_t size;
|
||||||
bool isDirectory;
|
bool isDirectory;
|
||||||
bool isApp;
|
bool isApp;
|
||||||
} ;
|
} ;
|
||||||
@ -101,6 +102,9 @@ void getDirectoryContents (vector<DirEntry>& dirContents) {
|
|||||||
} else if (strcmp(pent->d_name, "..") != 0) {
|
} 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) {
|
||||||
|
dirEntry.size = getFileSize(dirEntry.name.c_str());
|
||||||
|
}
|
||||||
if((dirEntry.name.substr(dirEntry.name.find_last_of(".") + 1) == "nds")
|
if((dirEntry.name.substr(dirEntry.name.find_last_of(".") + 1) == "nds")
|
||||||
|| (dirEntry.name.substr(dirEntry.name.find_last_of(".") + 1) == "NDS")
|
|| (dirEntry.name.substr(dirEntry.name.find_last_of(".") + 1) == "NDS")
|
||||||
|| (dirEntry.name.substr(dirEntry.name.find_last_of(".") + 1) == "argv")
|
|| (dirEntry.name.substr(dirEntry.name.find_last_of(".") + 1) == "argv")
|
||||||
@ -367,7 +371,6 @@ string browseForFile (void) {
|
|||||||
int pressed = 0;
|
int pressed = 0;
|
||||||
int screenOffset = 0;
|
int screenOffset = 0;
|
||||||
int fileOffset = 0;
|
int fileOffset = 0;
|
||||||
off_t fileSize = 0;
|
|
||||||
vector<DirEntry> dirContents;
|
vector<DirEntry> dirContents;
|
||||||
|
|
||||||
getDirectoryContents (dirContents);
|
getDirectoryContents (dirContents);
|
||||||
@ -382,8 +385,7 @@ string browseForFile (void) {
|
|||||||
if (entry->isDirectory) {
|
if (entry->isDirectory) {
|
||||||
printf ("(dir)");
|
printf ("(dir)");
|
||||||
} else {
|
} else {
|
||||||
fileSize = getFileSize(entry->name.c_str());
|
printf ("%i Bytes", (int)entry->size);
|
||||||
printf ("%i Bytes", (int)fileSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clipboardOn) {
|
if (clipboardOn) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user