summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-12 16:45:59 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-12 16:45:59 -0300
commit2dfa1279eaed14c4d42d431fc62f3e8c881c2d38 (patch)
treee219ec21cbde6ba7643ec4d9c9a49f67f7ae45e0 /tools
parent87c51b6fc0504e4943ee3edec5e0fa06097d8b96 (diff)
improved save path error messages for scene, textures and audio, fixes #1514
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/io_plugins/editor_sample_import_plugin.cpp18
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp21
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp17
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