diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2023-03-08 12:30:37 +0800 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-13 14:11:24 +0100 |
commit | 2d0d07f51b5caf16d43eab7e8526250e371942d5 (patch) | |
tree | 3e1dd7a2aeee168cd5106276b3a71a33744795c9 /core | |
parent | 5662542526f95c57cb43c72e8f9804cdb2cd8906 (diff) |
Fix crash when dumping extension API in a non-writable directory
(cherry picked from commit 49400e0c1c2c745942133cd63daefad82608958c)
Diffstat (limited to 'core')
-rw-r--r-- | core/extension/extension_api_dump.cpp | 1 | ||||
-rw-r--r-- | core/extension/make_interface_dumper.py | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp index e26ead6d8c..79b0ebc641 100644 --- a/core/extension/extension_api_dump.cpp +++ b/core/extension/extension_api_dump.cpp @@ -1052,6 +1052,7 @@ void GDExtensionAPIDump::generate_extension_json_file(const String &p_path) { String text = json->stringify(api, "\t", false) + "\n"; Ref<FileAccess> fa = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_MSG(fa.is_null(), vformat("Cannot open file '%s' for writing.", p_path)); fa->store_string(text); } diff --git a/core/extension/make_interface_dumper.py b/core/extension/make_interface_dumper.py index a8af0e9ff6..a604112d13 100644 --- a/core/extension/make_interface_dumper.py +++ b/core/extension/make_interface_dumper.py @@ -27,6 +27,7 @@ class GDExtensionInterfaceDump { public: static void generate_gdextension_interface_file(const String &p_path) { Ref<FileAccess> fa = FileAccess::open(p_path, FileAccess::WRITE); + ERR_FAIL_COND_MSG(fa.is_null(), vformat("Cannot open file '%s' for writing.", p_path)); CharString cs(gdextension_interface_dump); fa->store_buffer((const uint8_t *)cs.ptr(), cs.length()); }; |