mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Godot3 exporter: Prevent exporting within project directory
This commit is contained in:
parent
6dced62187
commit
a0de1b8999
1 changed files with 18 additions and 1 deletions
|
|
@ -5084,9 +5084,26 @@ void EditorNode::_bind_methods() {
|
|||
|
||||
void EditorNode::_export_godot3_path(const String &p_path) {
|
||||
|
||||
// Prevent exporting within the current project folder
|
||||
// Copied from ProjectExportDialog
|
||||
String location = Globals::get_singleton()->globalize_path(p_path).replace("\\", "/");
|
||||
while (true) {
|
||||
|
||||
if (FileAccess::exists(location.plus_file("engine.cfg"))) {
|
||||
|
||||
accept->set_text(TTR("Please export outside the project folder!"));
|
||||
accept->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
String nl = (location + "/..").simplify_path();
|
||||
if (nl.find("/") == location.find_last("/"))
|
||||
break;
|
||||
location = nl;
|
||||
}
|
||||
|
||||
Error err = export_godot3.export_godot3(p_path, export_godot3_dialog_convert_scripts->is_pressed());
|
||||
if (err != OK) {
|
||||
show_warning("Error exporting to Godot 3.0");
|
||||
show_warning(TTR("Error exporting project to Godot 3.0."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue