summaryrefslogtreecommitdiff
path: root/platform/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'platform/javascript')
-rw-r--r--platform/javascript/export/export.cpp18
-rw-r--r--platform/javascript/os_javascript.cpp6
-rw-r--r--platform/javascript/os_javascript.h2
3 files changed, 14 insertions, 12 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 6c2b6799a6..a3514df05c 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -174,14 +174,14 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
}
if (template_path != String() && !FileAccess::exists(template_path)) {
- EditorNode::get_singleton()->show_warning(TTR("Template file not found:\n") + template_path);
+ EditorNode::get_singleton()->show_warning(TTR("Template file not found:") + "\n" + template_path);
return ERR_FILE_NOT_FOUND;
}
String pck_path = p_path.get_basename() + ".pck";
Error error = save_pack(p_preset, pck_path);
if (error != OK) {
- EditorNode::get_singleton()->show_warning(TTR("Could not write file:\n") + pck_path);
+ EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + pck_path);
return error;
}
@@ -191,12 +191,12 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
if (!pkg) {
- EditorNode::get_singleton()->show_warning(TTR("Could not open template for export:\n") + template_path);
+ EditorNode::get_singleton()->show_warning(TTR("Could not open template for export:") + "\n" + template_path);
return ERR_FILE_NOT_FOUND;
}
if (unzGoToFirstFile(pkg) != UNZ_OK) {
- EditorNode::get_singleton()->show_warning(TTR("Invalid export template:\n") + template_path);
+ EditorNode::get_singleton()->show_warning(TTR("Invalid export template:") + "\n" + template_path);
unzClose(pkg);
return ERR_FILE_CORRUPT;
}
@@ -238,7 +238,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
String dst = p_path.get_base_dir().plus_file(file);
FileAccess *f = FileAccess::open(dst, FileAccess::WRITE);
if (!f) {
- EditorNode::get_singleton()->show_warning(TTR("Could not write file:\n") + dst);
+ EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + dst);
unzClose(pkg);
return ERR_FILE_CANT_WRITE;
}
@@ -252,7 +252,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
FileAccess *f = FileAccess::open(custom_html, FileAccess::READ);
if (!f) {
- EditorNode::get_singleton()->show_warning(TTR("Could not read custom HTML shell:\n") + custom_html);
+ EditorNode::get_singleton()->show_warning(TTR("Could not read custom HTML shell:") + "\n" + custom_html);
return ERR_FILE_CANT_READ;
}
Vector<uint8_t> buf;
@@ -263,7 +263,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
f = FileAccess::open(p_path, FileAccess::WRITE);
if (!f) {
- EditorNode::get_singleton()->show_warning(TTR("Could not write file:\n") + p_path);
+ EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + p_path);
return ERR_FILE_CANT_WRITE;
}
f->store_buffer(buf.ptr(), buf.size());
@@ -277,7 +277,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
splash.instance();
Error err = splash->load(splash_path);
if (err) {
- EditorNode::get_singleton()->show_warning(TTR("Could not read boot splash image file:\n") + splash_path + "\nUsing default boot splash image");
+ EditorNode::get_singleton()->show_warning(TTR("Could not read boot splash image file:") + "\n" + splash_path + "\n" + TTR("Using default boot splash image."));
splash.unref();
}
}
@@ -286,7 +286,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
}
String png_path = p_path.get_base_dir().plus_file(p_path.get_file().get_basename() + ".png");
if (splash->save_png(png_path) != OK) {
- EditorNode::get_singleton()->show_warning(TTR("Could not write file:\n") + png_path);
+ EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + png_path);
return ERR_FILE_CANT_WRITE;
}
return OK;
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 0bdd090ba9..26fb380aed 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -419,7 +419,7 @@ void send_notification(int notif) {
}
}
-void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
print_line("Init OS");
@@ -429,7 +429,7 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i
attributes.antialias = false;
attributes.majorVersion = 2;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes);
- ERR_FAIL_COND(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS);
+ ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);
video_mode = p_desired;
// can't fulfil fullscreen request due to browser security
@@ -507,6 +507,8 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i
#undef EM_CHECK
visual_server->init();
+
+ return OK;
}
void OS_JavaScript::set_main_loop(MainLoop *p_main_loop) {
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 8acaac9ef3..eaf8465be9 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -82,7 +82,7 @@ public:
virtual const char *get_audio_driver_name(int p_driver) const;
virtual void initialize_core();
- virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
+ virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
virtual void set_main_loop(MainLoop *p_main_loop);
virtual void delete_main_loop();