mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Recursive size calculation for PBP directory games. Other minor updates
This commit is contained in:
1 parent
2a88b1e58d
commit
954735bde6
2 files changed
+17
-13
No files matched your search
+17
-12
@@ -93,23 +93,28 @@ bool GameInfo::Delete() {
|
||||
}
|
||||
}
|
||||
|
||||
static int64_t GetDirectoryRecursiveSize(std::string path) {
|
||||
std::vector<FileInfo> fileInfo;
|
||||
getFilesInDir(path.c_str(), &fileInfo);
|
||||
int64_t sizeSum = 0;
|
||||
// Note: getFileInDir does not fill in fileSize properly.
|
||||
for (size_t i = 0; i < fileInfo.size(); i++) {
|
||||
FileInfo finfo;
|
||||
getFileInfo(fileInfo[i].fullName.c_str(), &finfo);
|
||||
if (!finfo.isDirectory)
|
||||
sizeSum += finfo.size;
|
||||
else
|
||||
sizeSum += GetDirectoryRecursiveSize(finfo.fullName);
|
||||
}
|
||||
return sizeSum;
|
||||
}
|
||||
|
||||
u64 GameInfo::GetGameSizeInBytes() {
|
||||
switch (fileType) {
|
||||
case FILETYPE_PSP_PBP_DIRECTORY:
|
||||
case FILETYPE_PSP_SAVEDATA_DIRECTORY:
|
||||
{
|
||||
std::vector<FileInfo> fileInfo;
|
||||
getFilesInDir(filePath_.c_str(), &fileInfo);
|
||||
int64_t sizeSum = 0;
|
||||
// Note: getFileInDir does not fill in fileSize properly.
|
||||
for (size_t i = 0; i < fileInfo.size(); i++) {
|
||||
FileInfo finfo;
|
||||
getFileInfo(fileInfo[i].fullName.c_str(), &finfo);
|
||||
if (!finfo.isDirectory)
|
||||
sizeSum += finfo.size;
|
||||
}
|
||||
// TODO: Need to recurse here.
|
||||
return sizeSum;
|
||||
return GetDirectoryRecursiveSize(filePath_);
|
||||
}
|
||||
default:
|
||||
return GetFileLoader()->FileSize();
|
||||
|
||||
Reference in new issue
Block a user