libobs/util: Add function to get free disk space
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user