Use JSON::stringify
where possible
This commit is contained in:
parent
28f642097a
commit
fe56c1ff75
@ -1932,8 +1932,7 @@ String Variant::stringify(int recursion_count) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String Variant::to_json_string() const {
|
String Variant::to_json_string() const {
|
||||||
JSON json;
|
return JSON::stringify(*this);
|
||||||
return json.stringify(*this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::operator Vector2() const {
|
Variant::operator Vector2() const {
|
||||||
|
@ -656,7 +656,7 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) {
|
|||||||
|
|
||||||
bool DebugAdapterProtocol::process_message(const String &p_text) {
|
bool DebugAdapterProtocol::process_message(const String &p_text) {
|
||||||
JSON json;
|
JSON json;
|
||||||
ERR_FAIL_COND_V_MSG(json.parse(p_text) != OK, true, "Mal-formed message!");
|
ERR_FAIL_COND_V_MSG(json.parse(p_text) != OK, true, "Malformed message!");
|
||||||
Dictionary params = json.get_data();
|
Dictionary params = json.get_data();
|
||||||
bool completed = true;
|
bool completed = true;
|
||||||
|
|
||||||
|
@ -255,8 +255,7 @@ Error EditorBuildProfile::save_to_file(const String &p_path) {
|
|||||||
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE);
|
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE);
|
||||||
ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_CREATE, "Cannot create file '" + p_path + "'.");
|
ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_CREATE, "Cannot create file '" + p_path + "'.");
|
||||||
|
|
||||||
JSON json;
|
String text = JSON::stringify(data, "\t");
|
||||||
String text = json.stringify(data, "\t");
|
|
||||||
f->store_string(text);
|
f->store_string(text);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||||||
|
|
||||||
Ref<FileAccess> f = FileAccess::open(p_output_file, FileAccess::WRITE);
|
Ref<FileAccess> f = FileAccess::open(p_output_file, FileAccess::WRITE);
|
||||||
ERR_FAIL_COND_MSG(f.is_null(), "Cannot open file '" + p_output_file + "'.");
|
ERR_FAIL_COND_MSG(f.is_null(), "Cannot open file '" + p_output_file + "'.");
|
||||||
JSON json;
|
f->store_string(JSON::stringify(classes_dict, "\t"));
|
||||||
f->store_string(json.stringify(classes_dict, "\t"));
|
|
||||||
|
|
||||||
print_line(String() + "ClassDB API JSON written to: " + ProjectSettings::get_singleton()->globalize_path(p_output_file));
|
print_line(String() + "ClassDB API JSON written to: " + ProjectSettings::get_singleton()->globalize_path(p_output_file));
|
||||||
}
|
}
|
||||||
|
@ -2639,8 +2639,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||||||
}
|
}
|
||||||
if (user_data.libs.size() > 0) {
|
if (user_data.libs.size() > 0) {
|
||||||
Ref<FileAccess> fa = FileAccess::open(GDNATIVE_LIBS_PATH, FileAccess::WRITE);
|
Ref<FileAccess> fa = FileAccess::open(GDNATIVE_LIBS_PATH, FileAccess::WRITE);
|
||||||
JSON json;
|
fa->store_string(JSON::stringify(user_data.libs, "\t"));
|
||||||
fa->store_string(json.stringify(user_data.libs, "\t"));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print_verbose("Saving apk expansion file..");
|
print_verbose("Saving apk expansion file..");
|
||||||
|
Loading…
Reference in New Issue
Block a user