summaryrefslogtreecommitdiffstats
path: root/core/io/file_access.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/file_access.cpp')
-rw-r--r--core/io/file_access.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp
index 1cf388b33a..c857d54925 100644
--- a/core/io/file_access.cpp
+++ b/core/io/file_access.cpp
@@ -59,11 +59,9 @@ bool FileAccess::exists(const String &p_name) {
return true;
}
- Ref<FileAccess> f = open(p_name, READ);
- if (f.is_null()) {
- return false;
- }
- return true;
+ // Using file_exists because it's faster than trying to open the file.
+ Ref<FileAccess> ret = create_for_path(p_name);
+ return ret->file_exists(p_name);
}
void FileAccess::_set_access_type(AccessType p_access) {