Unverified Commit 6389b68c by Rémi Verschelde Committed by GitHub

Merge pull request #39214 from EricEzaM/improve-add-autoload-errors

Improved warning shown when autoload cannot be added.
parents 82da6aab 58caa2c4
...@@ -674,18 +674,18 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_ ...@@ -674,18 +674,18 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
String error; String error;
if (!_autoload_name_is_valid(name, &error)) { if (!_autoload_name_is_valid(name, &error)) {
EditorNode::get_singleton()->show_warning(error); EditorNode::get_singleton()->show_warning(TTR("Can't add autoload:") + "\n" + error);
return false; return false;
} }
const String &path = p_path; const String &path = p_path;
if (!FileAccess::exists(path)) { if (!FileAccess::exists(path)) {
EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist.")); EditorNode::get_singleton()->show_warning(TTR("Can't add autoload:") + "\n" + TTR(vformat("%s is an invalid path. File does not exist.", path)));
return false; return false;
} }
if (!path.begins_with("res://")) { if (!path.begins_with("res://")) {
EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("Not in resource path.")); EditorNode::get_singleton()->show_warning(TTR("Can't add autoload:") + "\n" + TTR(vformat("%s is an invalid path. Not in resource path (res://).", path)));
return false; return false;
} }
...@@ -912,4 +912,4 @@ void EditorAutoloadSettings::_set_autoload_add_path(const String &p_text) { ...@@ -912,4 +912,4 @@ void EditorAutoloadSettings::_set_autoload_add_path(const String &p_text) {
void EditorAutoloadSettings::_browse_autoload_add_path() { void EditorAutoloadSettings::_browse_autoload_add_path() {
file_dialog->popup_centered_ratio(); file_dialog->popup_centered_ratio();
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment