Hides special folders in FileDialog for macOS

(cherry picked from commit 1998f78679)
This commit is contained in:
Haoyu Qiu
2020-09-28 14:06:36 +08:00
committed by Rémi Verschelde
parent 0d8cbd5d8c
commit 7840a550b5
4 changed files with 18 additions and 1 deletions

View File

@ -47,6 +47,8 @@ protected:
virtual int get_drive_count();
virtual String get_drive(int p_drive);
virtual bool is_hidden(const String &p_name);
};
#endif //UNIX ENABLED

View File

@ -69,4 +69,14 @@ String DirAccessOSX::get_drive(int p_drive) {
return volname;
}
bool DirAccessOSX::is_hidden(const String &p_name) {
String f = get_current_dir().plus_file(p_name);
NSURL *url = [NSURL fileURLWithPath:@(f.utf8().get_data())];
NSNumber *hidden = nil;
if (![url getResourceValue:&hidden forKey:NSURLIsHiddenKey error:nil]) {
return DirAccessUnix::is_hidden(p_name);
}
return [hidden boolValue];
}
#endif //posix_enabled