diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-09-28 14:06:36 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-09-28 14:36:21 +0800 |
commit | 1998f7867940c60ac4ed8c009add64cf0a5a45a7 (patch) | |
tree | 24dd4ed50a179fd8fa7c0f46c65ddb98d71e2ec6 /drivers | |
parent | 80165210c31b79e12e2a59e481232ae7eeccbfac (diff) |
Hides special folders in FileDialog for macOS
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/unix/dir_access_unix.cpp | 6 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index 325a88b573..5b99a2f53f 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -152,7 +152,7 @@ String DirAccessUnix::get_next() { _cisdir = (entry->d_type == DT_DIR); } - _cishidden = (fname != "." && fname != ".." && fname.begins_with(".")); + _cishidden = is_hidden(fname); return fname; } @@ -400,6 +400,10 @@ String DirAccessUnix::get_filesystem_type() const { return ""; //TODO this should be implemented } +bool DirAccessUnix::is_hidden(const String &p_name) { + return p_name != "." && p_name != ".." && p_name.begins_with("."); +} + DirAccessUnix::DirAccessUnix() { dir_stream = nullptr; _cisdir = false; diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h index b897efcafc..90f98d4705 100644 --- a/drivers/unix/dir_access_unix.h +++ b/drivers/unix/dir_access_unix.h @@ -51,6 +51,7 @@ class DirAccessUnix : public DirAccess { protected: virtual String fix_unicode_name(const char *p_name) const { return String::utf8(p_name); } + virtual bool is_hidden(const String &p_name); public: virtual Error list_dir_begin(); ///< This starts dir listing |