Optimize install data size calculation.

This commit is contained in:
Henrik Rydgård committed 2021-09-11 15:13:37 +02:00
1 parent 830d205839
commit 369ae031de
1 file changed
+5 -6
+5 -6
View File
@@ -176,12 +176,11 @@ u64 GameInfo::GetInstallDataSizeInBytes() {
for (size_t j = 0; j < saveDataDir.size(); j++) {
std::vector<File::FileInfo> fileInfo;
File::GetFilesInDir(saveDataDir[j], &fileInfo);
// Note: GetFilesInDir does not fill in fileSize properly.
for (size_t i = 0; i < fileInfo.size(); i++) {
File::FileInfo finfo;
File::GetFileInfo(fileInfo[i].fullName, &finfo);
if (!finfo.isDirectory)
filesSizeInDir += finfo.size;
for (auto const &file : fileInfo) {
// TODO: Might want to recurse here? Don't know games that use directories
// for install-data though.
if (!file.isDirectory)
filesSizeInDir += file.size;
}
if (filesSizeInDir >= 0xA00000) {
// HACK: Generally the savedata size in a dir shouldn't be more than 10MB.