summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-18 11:32:45 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-18 11:32:45 -0300
commite3905a084e614738fa6565144bf364b8f364f2ae (patch)
tree6d375fa7e86e2b6c83814959723ea013d775ba91 /drivers
parent61655d6dc2912424de937e2870b6a5ad346c3daf (diff)
-made get_space_left() return values more homogenous, also for script, converted to mb, closes #4617
Diffstat (limited to 'drivers')
-rw-r--r--drivers/unix/dir_access_unix.cpp2
-rw-r--r--drivers/windows/dir_access_windows.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 1e55e39e31..f0e4511b1d 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -321,7 +321,7 @@ size_t DirAccessUnix::get_space_left() {
struct statvfs vfs;
if (statvfs(current_dir.utf8().get_data(), &vfs) != 0) {
- return -1;
+ return 0;
};
return vfs.f_bfree * vfs.f_bsize;
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index f64eb036c3..6cd494de4e 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -359,7 +359,8 @@ FileType DirAccessWindows::get_file_type(const String& p_file) const {
size_t DirAccessWindows::get_space_left() {
uint64_t bytes = 0;
- GetDiskFreeSpaceEx(NULL,(PULARGE_INTEGER)&bytes,NULL,NULL);
+ if (!GetDiskFreeSpaceEx(NULL,(PULARGE_INTEGER)&bytes,NULL,NULL))
+ return 0;
//this is either 0 or a value in bytes.
return (size_t)bytes;