summaryrefslogtreecommitdiff
path: root/platform/javascript
diff options
context:
space:
mode:
authorMarcel Admiraal <madmiraal@users.noreply.github.com>2020-12-29 18:12:33 +0000
committerMarcel Admiraal <madmiraal@users.noreply.github.com>2021-06-19 08:01:40 +0100
commit2bafcd3422bea8baf2282f5de87538a59f0bb254 (patch)
tree7c9d09df5f4d8d0a575f53724eb95b02521fb5e8 /platform/javascript
parentdf170c8af05c7e81a83ddae4e4d62c65d7086bc3 (diff)
Consolidate JSON, JSONParseResults and JSONParser into JSON
Renames JSON.parse_string() to parse() Renames JSON.decode_data() to stringify()
Diffstat (limited to 'platform/javascript')
-rw-r--r--platform/javascript/export/export.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 7e49feee61..823f9b8281 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "core/io/image_loader.h"
-#include "core/io/json.h"
#include "core/io/stream_peer_ssl.h"
#include "core/io/tcp_server.h"
#include "core/io/zip_io.h"
@@ -465,7 +464,7 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re
}
// Replaces HTML string
- const String str_config = JSON::print(config);
+ const String str_config = Variant(config).to_json_string();
const String custom_head_include = p_preset->get("html/head_include");
Map<String, String> replaces;
replaces["$GODOT_URL"] = p_name + ".js";
@@ -518,7 +517,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> &
replaces["@GODOT_NAME@"] = name;
replaces["@GODOT_OFFLINE_PAGE@"] = name + ".offline.html";
Array files;
- replaces["@GODOT_OPT_CACHE@"] = JSON::print(files);
+ replaces["@GODOT_OPT_CACHE@"] = Variant(files).to_json_string();
files.push_back(name + ".html");
files.push_back(name + ".js");
files.push_back(name + ".wasm");
@@ -537,7 +536,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> &
files.push_back(p_shared_objects[i].path.get_file());
}
}
- replaces["@GODOT_CACHE@"] = JSON::print(files);
+ replaces["@GODOT_CACHE@"] = Variant(files).to_json_string();
const String sw_path = dir.plus_file(name + ".service.worker.js");
Vector<uint8_t> sw;
@@ -605,7 +604,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> &
}
manifest["icons"] = icons_arr;
- CharString cs = JSON::print(manifest).utf8();
+ CharString cs = Variant(manifest).to_json_string().utf8();
err = _write_or_error((const uint8_t *)cs.get_data(), cs.length(), dir.plus_file(name + ".manifest.json"));
if (err != OK) {
return err;