improved save path error messages for scene, textures and audio, fixes #1514
This commit is contained in:
parent
87c51b6fc0
commit
2dfa1279ea
|
@ -399,6 +399,15 @@ Error DirAccess::copy(String p_from,String p_to) {
|
|||
return err;
|
||||
}
|
||||
|
||||
bool DirAccess::exists(String p_dir) {
|
||||
|
||||
DirAccess* da = DirAccess::create_for_path(p_dir);
|
||||
bool valid = da->change_dir(p_dir)==OK;
|
||||
memdelete(da);
|
||||
return valid;
|
||||
|
||||
}
|
||||
|
||||
DirAccess::DirAccess(){
|
||||
|
||||
_access_type=ACCESS_FILESYSTEM;
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
|
||||
virtual bool file_exists(String p_file)=0;
|
||||
virtual bool dir_exists(String p_dir)=0;
|
||||
|
||||
static bool exists(String p_dir);
|
||||
virtual size_t get_space_left()=0;
|
||||
|
||||
virtual Error copy(String p_from,String p_to);
|
||||
|
|
|
@ -266,6 +266,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
|||
continue;
|
||||
if (AudioDriverManagerSW::get_driver(i)->init()==OK) {
|
||||
success=true;
|
||||
print_line("Audio Driver Failed: "+String(AudioDriverManagerSW::get_driver(p_audio_driver)->get_name()));
|
||||
print_line("Using alternate audio driver: "+String(AudioDriverManagerSW::get_driver(i)->get_name()));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -321,12 +321,23 @@ void EditorTextureImportDialog::_import() {
|
|||
|
||||
String dst_path=save_path->get_text();
|
||||
|
||||
if (dst_path.empty()) {
|
||||
|
||||
error_dialog->set_text("Please specify a valid target import path!");
|
||||
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 (!atlas && !DirAccess::exists(save_path->get_text())) {
|
||||
error_dialog->set_text("Target path must exist.");
|
||||
error_dialog->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
|
||||
if (atlas) { //atlas
|
||||
|
|
Loading…
Reference in New Issue