diff options
author | Tomasz Chabora <kobewi4e@gmail.com> | 2020-01-08 15:11:16 +0100 |
---|---|---|
committer | Tomasz Chabora <kobewi4e@gmail.com> | 2020-01-08 15:24:43 +0100 |
commit | 97273ce37889d25a8959086fc0a46099d901b2fa (patch) | |
tree | 812aabea13061e4a06962df8f0317f584ca2e204 /core/io | |
parent | 16f0357c8e2dbba77d3691c2a507c4f6872934a5 (diff) |
Check if resource exists before loading
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/resource_loader.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 5d85634895..7471ab4241 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -277,6 +277,11 @@ RES ResourceLoader::_load(const String &p_path, const String &p_original_path, c ERR_FAIL_COND_V_MSG(found, RES(), "Failed loading resource: " + p_path + "."); +#ifdef TOOLS_ENABLED + FileAccessRef file_check = FileAccess::create(FileAccess::ACCESS_RESOURCES); + ERR_FAIL_COND_V_MSG(!file_check->file_exists(p_path), RES(), "Resource file not found: " + p_path + "."); +#endif + ERR_FAIL_V_MSG(RES(), "No loader found for resource: " + p_path + "."); } |