You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Somewhat fixed Directory::get_space_left() return values.
This commit is contained in:
@@ -359,8 +359,12 @@ FileType DirAccessWindows::get_file_type(const String& p_file) const {
|
|||||||
*/
|
*/
|
||||||
size_t DirAccessWindows::get_space_left() {
|
size_t DirAccessWindows::get_space_left() {
|
||||||
|
|
||||||
return -1;
|
uint64_t bytes = 0;
|
||||||
};
|
GetDiskFreeSpaceEx(NULL,(PULARGE_INTEGER)&bytes,NULL,NULL);
|
||||||
|
|
||||||
|
//this is either 0 or a value in bytes.
|
||||||
|
return (size_t)bytes;
|
||||||
|
}
|
||||||
|
|
||||||
DirAccessWindows::DirAccessWindows() {
|
DirAccessWindows::DirAccessWindows() {
|
||||||
|
|
||||||
|
|||||||
@@ -319,10 +319,10 @@ size_t DirAccessOSX::get_space_left() {
|
|||||||
struct statvfs vfs;
|
struct statvfs vfs;
|
||||||
if (statvfs(current_dir.utf8().get_data(), &vfs) != 0) {
|
if (statvfs(current_dir.utf8().get_data(), &vfs) != 0) {
|
||||||
|
|
||||||
return -1;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
return vfs.f_bfree * vfs.f_bsize;
|
return (size_t) (vfs.f_bavail * vfs.f_bsize);
|
||||||
#else
|
#else
|
||||||
#warning THIS IS BROKEN
|
#warning THIS IS BROKEN
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user