You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Unix: Remove now unnecessary I/O defines, cleanup
- `LIBC_FILEIO_ENABLED` wasn't defined anywhere, even in _other platforms_. - `NO_NETWORK` is also never defined. It probably isn't enough anyway to disable network APIs in the current codebase. - `UNIX_SOCKET_UNAVAILABLE` is never defined in this code but used by some other platforms, clarify that. - `NO_STATVFS` can be removed as Android supports it since API level 19, which is our current min SDK level. It's also only used for `DirAccessUnix::get_space_left()` which is anyway overridden by `DirAccessJAndroid::get_space_left()` so it shouldn't make a difference. * Fixed documentation for `DirAccess.get_space_left()`. - `NO_FCNTL` is likely also a remnant of early Android days, in current NDK r23 it seems to be available. Also cleaned up unused `fcntl.h` includes. - `NO_ALLOCA` is never defined, and we use alloca in many places now.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "dir_access_unix.h"
|
||||
|
||||
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
|
||||
#if defined(UNIX_ENABLED)
|
||||
|
||||
#include "core/os/memory.h"
|
||||
#include "core/os/os.h"
|
||||
@@ -41,10 +41,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef ANDROID_ENABLED
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MNTENT
|
||||
#include <mntent.h>
|
||||
@@ -475,17 +472,12 @@ Error DirAccessUnix::create_link(String p_source, String p_target) {
|
||||
}
|
||||
|
||||
uint64_t DirAccessUnix::get_space_left() {
|
||||
#ifndef NO_STATVFS
|
||||
struct statvfs vfs;
|
||||
if (statvfs(current_dir.utf8().get_data(), &vfs) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (uint64_t)vfs.f_bavail * (uint64_t)vfs.f_frsize;
|
||||
#else
|
||||
// FIXME: Implement this.
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
String DirAccessUnix::get_filesystem_type() const {
|
||||
@@ -516,4 +508,4 @@ DirAccessUnix::~DirAccessUnix() {
|
||||
list_dir_end();
|
||||
}
|
||||
|
||||
#endif // UNIX_ENABLED || LIBC_FILEIO_ENABLED
|
||||
#endif // UNIX_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user