mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 11:36:22 +00:00
CLOUD: Fix FolderDownloadRequest::getProgress()
Now it doesn't stop on 100 % on last file and it ignores the directories, so it doesn't "jump" suddenly as there are no directories to skip.
This commit is contained in:
parent
cdf8ab7949
commit
d863dad055
@ -65,6 +65,14 @@ void FolderDownloadRequest::directoryListedCallback(Storage::ListDirectoryRespon
|
||||
_workingRequest = nullptr;
|
||||
if (_ignoreCallback) return;
|
||||
_pendingFiles = response.value;
|
||||
|
||||
// remove all directories
|
||||
for (Common::Array<StorageFile>::iterator i = _pendingFiles.begin(); i != _pendingFiles.end(); )
|
||||
if (i->isDirectory())
|
||||
_pendingFiles.erase(i);
|
||||
else
|
||||
++i;
|
||||
|
||||
_totalFiles = _pendingFiles.size();
|
||||
downloadNextFile();
|
||||
}
|
||||
@ -146,7 +154,8 @@ double FolderDownloadRequest::getProgress() const {
|
||||
if (idDownloadRequest != nullptr) currentFileProgress = idDownloadRequest->getProgress();
|
||||
}
|
||||
|
||||
return (double)(_totalFiles - _pendingFiles.size() + currentFileProgress) / (double)(_totalFiles);
|
||||
uint32 uploadedFiles = _totalFiles - _pendingFiles.size() - 1; // -1 because currently downloaded file is already removed from _pendingFiles
|
||||
return (double)(uploadedFiles + currentFileProgress) / (double)(_totalFiles);
|
||||
}
|
||||
|
||||
} // End of namespace Cloud
|
||||
|
Loading…
x
Reference in New Issue
Block a user