libobs/util: Add function to get free disk space

This commit is contained in:
jp9000
2017-05-12 00:42:58 -07:00
parent ce44791932
commit 9e466a4697
3 changed files with 24 additions and 0 deletions

View File

@@ -946,3 +946,16 @@ int os_get_logical_cores(void)
os_get_cores_internal();
return logical_cores;
}
uint64_t os_get_free_disk_space(const char *dir)
{
wchar_t *wdir = NULL;
if (!os_utf8_to_wcs_ptr(dir, 0, &wdir))
return 0;
ULARGE_INTEGER free;
bool success = !!GetDiskFreeSpaceExW(wdir, &free, NULL, NULL);
bfree(wdir);
return success ? free.QuadPart : 0;
}