|
@@ -362,6 +362,25 @@ void os_closedir(os_dir_t *dir)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+int64_t os_get_free_space(const char *path)
|
|
|
+{
|
|
|
+ ULARGE_INTEGER remainingSpace;
|
|
|
+ char abs_path[512];
|
|
|
+ wchar_t w_abs_path[512];
|
|
|
+
|
|
|
+ if (os_get_abs_path(path, abs_path, 512) > 0) {
|
|
|
+ if (os_utf8_to_wcs(abs_path, 0, w_abs_path, 512) > 0) {
|
|
|
+ BOOL success = GetDiskFreeSpaceExW(w_abs_path,
|
|
|
+ (PULARGE_INTEGER)&remainingSpace,
|
|
|
+ NULL, NULL);
|
|
|
+ if (success)
|
|
|
+ return (int64_t)remainingSpace.QuadPart;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return -1;
|
|
|
+}
|
|
|
+
|
|
|
static void make_globent(struct os_globent *ent, WIN32_FIND_DATA *wfd,
|
|
|
const char *pattern)
|
|
|
{
|