23#include <yuni/core/system/memory.h>
24#include <yuni/core/system/windows.hdr.h>
25#include <yuni/core/string/wstring.h>
26#include <antares/logs/logs.h>
30template<
class StringT>
31static inline StringT& BytesToStringW(StringT& out, uint64_t size)
34 return out << L
"0 byte";
38 return out << size << L
" bytes";
40 if (size < 1024 * 1024)
41 return out << (size / 1024) << L
" KiB";
43 if (size < 1024 * 1024 * 1024)
44 return out << (size / (1024 * 1024)) << L
" MiB";
47 double s = size / (1024. * 1024 * 1024);
48 return out << Math::Round(s, 1) << L
" GiB";
51static inline uint64_t DiskFreeSpace(
const AnyString& folder)
57 unsigned __int64 i64FreeBytesToCaller;
62 Yuni::WString wstr(folder);
66 if (GetDiskFreeSpaceExW(wstr.c_str(),
67 (PULARGE_INTEGER)&i64FreeBytesToCaller,
74 return i64FreeBytesToCaller;
80 Yuni::WString wstr(folder);
84 if (GetDiskFreeSpaceExW(wstr.c_str(),
85 (PULARGE_INTEGER)&i64FreeBytesToCaller,
92 return i64FreeBytesToCaller;