diff options
Diffstat (limited to 'tools')
3 files changed, 49 insertions, 7 deletions
diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index 377af8f179..196b1ecd94 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -254,6 +254,24 @@ public: error_dialog->popup_centered(Size2(200,100)); } + if (save_path->get_text().strip_edges()=="") { + error_dialog->set_text("Target path is empty."); + error_dialog->popup_centered_minsize(); + return; + } + + if (!save_path->get_text().begins_with("res://")) { + error_dialog->set_text("Target path must be full resource path."); + error_dialog->popup_centered_minsize(); + return; + } + + if (!DirAccess::exists(save_path->get_text())) { + error_dialog->set_text("Target path must exist."); + error_dialog->popup_centered_minsize(); + return; + } + for(int i=0;i<samples.size();i++) { Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata ); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index d01c2af907..20be43cd5f 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -671,15 +671,28 @@ void EditorSceneImportDialog::_import(bool p_and_open) { wip_open=p_and_open; //' ImportMonitorBlock imb; - if (import_path->get_text()=="") { + + if (import_path->get_text().strip_edges()=="") { error_dialog->set_text("Source path is empty."); - error_dialog->popup_centered(Size2(200,100)); + error_dialog->popup_centered_minsize(); return; } - if (save_path->get_text()=="") { + if (save_path->get_text().strip_edges()=="") { error_dialog->set_text("Target path is empty."); - error_dialog->popup_centered(Size2(200,100)); + error_dialog->popup_centered_minsize(); + return; + } + + if (!save_path->get_text().begins_with("res://")) { + error_dialog->set_text("Target path must be full resource path."); + error_dialog->popup_centered_minsize(); + return; + } + + if (!DirAccess::exists(save_path->get_text())) { + error_dialog->set_text("Target path must exist."); + error_dialog->popup_centered_minsize(); return; } diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index ce376f2e7b..247989600d 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -321,12 +321,23 @@ void EditorTextureImportDialog::_import() { String dst_path=save_path->get_text(); - if (dst_path.empty()) { + if (save_path->get_text().strip_edges()=="") { + error_dialog->set_text("Target path is empty."); + error_dialog->popup_centered_minsize(); + return; + } - error_dialog->set_text("Please specify a valid target import path!"); - error_dialog->popup_centered(Size2(200,100)); + if (!save_path->get_text().begins_with("res://")) { + error_dialog->set_text("Target path must be full resource path."); + error_dialog->popup_centered_minsize(); return; + } + + if (!atlas && !DirAccess::exists(save_path->get_text())) { + error_dialog->set_text("Target path must exist."); + error_dialog->popup_centered_minsize(); + return; } if (atlas) { //atlas |