summaryrefslogtreecommitdiff
path: root/drivers/unix
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/dir_access_unix.cpp9
-rw-r--r--drivers/unix/file_access_unix.cpp11
-rw-r--r--drivers/unix/file_access_unix.h4
3 files changed, 18 insertions, 6 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 45ea654bad..e7054e11a3 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -183,17 +183,18 @@ void DirAccessUnix::list_dir_end() {
_cisdir = false;
}
-#ifdef HAVE_MNTENT
+#if defined(HAVE_MNTENT) && defined(X11_ENABLED)
static bool _filter_drive(struct mntent *mnt) {
// Ignore devices that don't point to /dev
if (strncmp(mnt->mnt_fsname, "/dev", 4) != 0) {
return false;
}
- // Accept devices mounted at /media, /mnt or /home
+ // Accept devices mounted at common locations
if (strncmp(mnt->mnt_dir, "/media", 6) == 0 ||
strncmp(mnt->mnt_dir, "/mnt", 4) == 0 ||
- strncmp(mnt->mnt_dir, "/home", 5) == 0) {
+ strncmp(mnt->mnt_dir, "/home", 5) == 0 ||
+ strncmp(mnt->mnt_dir, "/run/media", 10) == 0) {
return true;
}
@@ -204,7 +205,7 @@ static bool _filter_drive(struct mntent *mnt) {
static void _get_drives(List<String> *list) {
-#ifdef HAVE_MNTENT
+#if defined(HAVE_MNTENT) && defined(X11_ENABLED)
// Check /etc/mtab for the list of mounted partitions
FILE *mtab = setmntent("/etc/mtab", "r");
if (mtab) {
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 80565c5b02..649f874cf4 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -168,7 +168,7 @@ void FileAccessUnix::seek_end(int64_t p_position) {
check_errors();
}
-size_t FileAccessUnix::get_pos() const {
+size_t FileAccessUnix::get_position() const {
ERR_FAIL_COND_V(!f, 0);
@@ -274,6 +274,15 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) {
};
}
+Error FileAccessUnix::_chmod(const String &p_path, int p_mod) {
+ int err = chmod(p_path.utf8().get_data(), p_mod);
+ if (!err) {
+ return OK;
+ }
+
+ return FAILED;
+}
+
FileAccess *FileAccessUnix::create_libc() {
return memnew(FileAccessUnix);
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 6e5110431f..e2848e4128 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -62,7 +62,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
@@ -78,6 +78,8 @@ public:
virtual uint64_t _get_modified_time(const String &p_file);
+ virtual Error _chmod(const String &p_path, int p_mod);
+
FileAccessUnix();
virtual ~FileAccessUnix();
};