Improved warning shown when autoload cannot be added.

(cherry picked from commit 58caa2c453)
This commit is contained in:
Eric M 2020-06-01 16:32:28 +10:00 committed by Rémi Verschelde
parent 61da4882aa
commit f911ebc328
1 changed files with 3 additions and 3 deletions

View File

@ -669,18 +669,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;
} }