mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 00:04:49 +02:00
Check actual free disk space when games ask.
Windows only for the moment.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include <limits>
|
||||
#include "ChunkFile.h"
|
||||
#include "FileUtil.h"
|
||||
#include "DirectoryFileSystem.h"
|
||||
@@ -721,6 +722,20 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string path) {
|
||||
return myVector;
|
||||
}
|
||||
|
||||
u64 DirectoryFileSystem::FreeSpace(const std::string &path) {
|
||||
#ifdef _WIN32
|
||||
const std::wstring w32path = ConvertUTF8ToWString(GetLocalPath(path));
|
||||
ULARGE_INTEGER free;
|
||||
if (GetDiskFreeSpaceExW(w32path.c_str(), &free, nullptr, nullptr))
|
||||
return free.QuadPart;
|
||||
#else
|
||||
// TODO: Implement.
|
||||
#endif
|
||||
|
||||
// Just assume they're swimming in free disk space if we don't know otherwise.
|
||||
return std::numeric_limits<u64>::max();
|
||||
}
|
||||
|
||||
void DirectoryFileSystem::DoState(PointerWrap &p) {
|
||||
auto s = p.Section("DirectoryFileSystem", 0, 2);
|
||||
if (!s)
|
||||
|
||||
Reference in New Issue
Block a user