summaryrefslogtreecommitdiff
path: root/editor/script_create_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/script_create_dialog.cpp')
-rw-r--r--editor/script_create_dialog.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 8c36a71d71..be255ba4aa 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -56,6 +56,7 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_
class_name->deselect();
parent_name->set_text(p_base_name);
parent_name->deselect();
+
if (p_base_path != "") {
initial_bp = p_base_path.get_basename();
file_path->set_text(initial_bp + "." + ScriptServer::get_language(language_menu->get_selected())->get_extension());
@@ -359,7 +360,7 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
is_path_valid = false;
is_new_script_created = true;
- String p = p_path;
+ String p = p_path.strip_edges();
if (p == "") {
_msg_path_valid(false, TTR("Path is empty"));
@@ -367,6 +368,12 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
return;
}
+ if (p.get_file().get_basename() == "") {
+ _msg_path_valid(false, TTR("Filename is empty"));
+ _update_dialog();
+ return;
+ }
+
p = ProjectSettings::get_singleton()->localize_path(p);
if (!p.begins_with("res://")) {
_msg_path_valid(false, TTR("Path is not local"));
@@ -443,12 +450,6 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
return;
}
- if (p.get_file().get_basename() == "") {
- _msg_path_valid(false, TTR("Filename is empty"));
- _update_dialog();
- return;
- }
-
/* All checks passed */
is_path_valid = true;