diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-23 08:34:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-23 08:34:03 +0200 |
commit | 73f1f9b44ffa0ab64326e2158d859c78c12a32fc (patch) | |
tree | 3c0f0592d849d3231af523ba197d46add74e1a5f | |
parent | 2477d414a1643e94f411843ad48e58d32076600e (diff) | |
parent | 326f8560060c0a7234d9f3057313546f91662ace (diff) |
Merge pull request #31586 from SonerSound/issue_31533
Export path is the only path to be saved as a relative path
-rw-r--r-- | editor/editor_export.cpp | 6 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 15 | ||||
-rw-r--r-- | editor/project_export.cpp | 13 |
3 files changed, 9 insertions, 25 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index e2a750cf08..e58c7c992a 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -148,6 +148,12 @@ String EditorExportPreset::get_include_filter() const { void EditorExportPreset::set_export_path(const String &p_path) { export_path = p_path; + /* NOTE(SonerSound): if there is a need to implement a PropertyHint that specifically indicates a relative path, + * this should be removed. */ + if (export_path.is_abs_path()) { + String res_path = OS::get_singleton()->get_resource_dir(); + export_path = res_path.path_to_file(export_path); + } EditorExport::singleton->save_presets(); } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 20ba07c102..378dd34e39 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -209,13 +209,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() { void EditorPropertyPath::_path_selected(const String &p_path) { - String final_path = p_path; - if (final_path.is_abs_path()) { - String res_path = OS::get_singleton()->get_resource_dir() + "/"; - final_path = res_path.path_to_file(final_path); - } - - emit_changed(get_edited_property(), final_path); + emit_changed(get_edited_property(), p_path); update_property(); } void EditorPropertyPath::_path_pressed() { @@ -228,13 +222,6 @@ void EditorPropertyPath::_path_pressed() { } String full_path = get_edited_object()->get(get_edited_property()); - if (full_path.is_rel_path()) { - - if (!DirAccess::exists(full_path.get_base_dir())) { - DirAccessRef da(DirAccess::create(DirAccess::ACCESS_FILESYSTEM)); - da->make_dir_recursive(full_path.get_base_dir()); - } - } dialog->clear_filters(); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index c78a81dbe0..956da92c35 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -931,17 +931,8 @@ void ProjectExportDialog::_export_project() { export_project->add_filter("*." + extension_list[i] + " ; " + platform->get_name() + " Export"); } - String current_preset_export_path = current->get_export_path(); - - if (current_preset_export_path != "") { - - if (!DirAccess::exists(current_preset_export_path.get_base_dir())) { - - DirAccessRef da(DirAccess::create(DirAccess::ACCESS_FILESYSTEM)); - da->make_dir_recursive(current_preset_export_path.get_base_dir()); - } - - export_project->set_current_path(current_preset_export_path); + if (current->get_export_path() != "") { + export_project->set_current_path(current->get_export_path()); } else { if (extension_list.size() >= 1) { export_project->set_current_file(default_filename + "." + extension_list[0]); |