You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Fix FileAccess::create_temp() not using FileAccess::ModeFlags
This commit is contained in:
committed by
Rémi Verschelde
parent
8aa4a5207f
commit
0844d4b11f
@@ -34,6 +34,10 @@ Ref<FileAccess> FileAccess::_open_encrypted_bind_compat_98918(const String &p_pa
|
||||
return open_encrypted(p_path, p_mode_flags, p_key, Vector<uint8_t>());
|
||||
}
|
||||
|
||||
Ref<FileAccess> FileAccess::_create_temp_compat_114053(int p_mode_flags, const String &p_prefix, const String &p_extension, bool p_keep) {
|
||||
return _create_temp((ModeFlags)p_mode_flags, p_prefix, p_extension, p_keep);
|
||||
}
|
||||
|
||||
void FileAccess::store_8_bind_compat_78289(uint8_t p_dest) {
|
||||
store_8(p_dest);
|
||||
}
|
||||
@@ -100,6 +104,7 @@ String FileAccess::get_as_text_bind_compat_110867(bool p_skip_cr) const {
|
||||
|
||||
void FileAccess::_bind_compatibility_methods() {
|
||||
ClassDB::bind_compatibility_static_method("FileAccess", D_METHOD("open_encrypted", "path", "mode_flags", "key"), &FileAccess::_open_encrypted_bind_compat_98918);
|
||||
ClassDB::bind_compatibility_static_method("FileAccess", D_METHOD("create_temp", "mode_flags", "prefix", "extension", "keep"), &FileAccess::_create_temp_compat_114053, DEFVAL(""), DEFVAL(""), DEFVAL(false));
|
||||
|
||||
ClassDB::bind_compatibility_method(D_METHOD("store_8", "value"), &FileAccess::store_8_bind_compat_78289);
|
||||
ClassDB::bind_compatibility_method(D_METHOD("store_16", "value"), &FileAccess::store_16_bind_compat_78289);
|
||||
|
||||
@@ -79,7 +79,7 @@ Ref<FileAccess> FileAccess::create_for_path(const String &p_path) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
Ref<FileAccess> FileAccess::create_temp(int p_mode_flags, const String &p_prefix, const String &p_extension, bool p_keep, Error *r_error) {
|
||||
Ref<FileAccess> FileAccess::create_temp(ModeFlags p_mode_flags, const String &p_prefix, const String &p_extension, bool p_keep, Error *r_error) {
|
||||
const String ERROR_COMMON_PREFIX = "Error while creating temporary file";
|
||||
|
||||
if (!p_prefix.is_empty() && !p_prefix.is_valid_filename()) {
|
||||
@@ -136,7 +136,7 @@ Ref<FileAccess> FileAccess::create_temp(int p_mode_flags, const String &p_prefix
|
||||
return ret;
|
||||
}
|
||||
|
||||
Ref<FileAccess> FileAccess::_create_temp(int p_mode_flags, const String &p_prefix, const String &p_extension, bool p_keep) {
|
||||
Ref<FileAccess> FileAccess::_create_temp(ModeFlags p_mode_flags, const String &p_prefix, const String &p_extension, bool p_keep) {
|
||||
return create_temp(p_mode_flags, p_prefix, p_extension, p_keep, &last_file_open_error);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ protected:
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
static Ref<FileAccess> _open_encrypted_bind_compat_98918(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key);
|
||||
static Ref<FileAccess> _create_temp_compat_114053(int p_mode_flags, const String &p_prefix = "", const String &p_extension = "", bool p_keep = false);
|
||||
|
||||
void store_8_bind_compat_78289(uint8_t p_dest);
|
||||
void store_16_bind_compat_78289(uint16_t p_dest);
|
||||
@@ -160,7 +161,7 @@ private:
|
||||
String _temp_path;
|
||||
void _delete_temp();
|
||||
|
||||
static Ref<FileAccess> _create_temp(int p_mode_flags, const String &p_prefix = "", const String &p_extension = "", bool p_keep = false);
|
||||
static Ref<FileAccess> _create_temp(ModeFlags p_mode_flags, const String &p_prefix = "", const String &p_extension = "", bool p_keep = false);
|
||||
|
||||
public:
|
||||
static void set_file_close_fail_notify_callback(FileCloseFailNotify p_cbk) { close_fail_notify = p_cbk; }
|
||||
@@ -241,7 +242,7 @@ public:
|
||||
static Ref<FileAccess> create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files.
|
||||
static Ref<FileAccess> create_for_path(const String &p_path);
|
||||
static Ref<FileAccess> open(const String &p_path, int p_mode_flags, Error *r_error = nullptr); /// Create a file access (for the current platform) this is the only portable way of accessing files.
|
||||
static Ref<FileAccess> create_temp(int p_mode_flags, const String &p_prefix = "", const String &p_extension = "", bool p_keep = false, Error *r_error = nullptr);
|
||||
static Ref<FileAccess> create_temp(ModeFlags p_mode_flags, const String &p_prefix = "", const String &p_extension = "", bool p_keep = false, Error *r_error = nullptr);
|
||||
|
||||
static Ref<FileAccess> open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key, const Vector<uint8_t> &p_iv = Vector<uint8_t>());
|
||||
static Ref<FileAccess> open_encrypted_pass(const String &p_path, ModeFlags p_mode_flags, const String &p_pass);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</method>
|
||||
<method name="create_temp" qualifiers="static">
|
||||
<return type="FileAccess" />
|
||||
<param index="0" name="mode_flags" type="int" />
|
||||
<param index="0" name="mode_flags" type="int" enum="FileAccess.ModeFlags" />
|
||||
<param index="1" name="prefix" type="String" default="""" />
|
||||
<param index="2" name="extension" type="String" default="""" />
|
||||
<param index="3" name="keep" type="bool" default="false" />
|
||||
|
||||
7
misc/extension_api_validation/4.5-stable/GH-114053.txt
Normal file
7
misc/extension_api_validation/4.5-stable/GH-114053.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
GH-114053
|
||||
---------
|
||||
Validate extension JSON: Error: Field 'classes/FileAccess/methods/create_temp/arguments': meta was removed.
|
||||
Validate extension JSON: Error: Field 'classes/FileAccess/methods/create_temp/arguments/0': type changed value in new API, from "int" to "enum::FileAccess.ModeFlags".
|
||||
|
||||
The argument was supposed to use this enum instead of an untyped int.
|
||||
A compatibility method has been registered.
|
||||
Reference in New Issue
Block a user