@@ -5702,6 +5702,30 @@ bool EditorNode::ensure_main_scene(bool p_from_native) {
57025702 return false ;
57035703 }
57045704
5705+ if (!EditorNode::validate_custom_directory ()) {
5706+ current_menu_option = -1 ;
5707+ return false ;
5708+ }
5709+
5710+ return true ;
5711+ }
5712+
5713+ bool EditorNode::validate_custom_directory () {
5714+ bool use_custom_dir = GLOBAL_GET (" application/config/use_custom_user_dir" );
5715+
5716+ if (use_custom_dir) {
5717+ String data_dir = OS::get_singleton ()->get_user_data_dir ();
5718+ Ref<DirAccess> dir = DirAccess::create (DirAccess::ACCESS_USERDATA);
5719+ if (dir->change_dir (data_dir) != OK) {
5720+ dir->make_dir_recursive (data_dir);
5721+ if (dir->change_dir (data_dir) != OK) {
5722+ open_project_settings->set_text (vformat (TTR (" User data dir '%s' is not valid. Change to a valid one?" ), data_dir));
5723+ open_project_settings->popup_centered ();
5724+ return false ;
5725+ }
5726+ }
5727+ }
5728+
57055729 return true ;
57065730}
57075731
@@ -8262,6 +8286,11 @@ EditorNode::EditorNode() {
82628286 select_current_scene_button = pick_main_scene->add_button (TTR (" Select Current" ), true , " select_current" );
82638287 pick_main_scene->connect (" custom_action" , callable_mp (this , &EditorNode::_pick_main_scene_custom_action));
82648288
8289+ open_project_settings = memnew (ConfirmationDialog);
8290+ gui_base->add_child (open_project_settings);
8291+ open_project_settings->set_ok_button_text (TTRC (" Open Project Settings" ));
8292+ open_project_settings->connect (SceneStringName (confirmed), callable_mp (this , &EditorNode::_menu_option).bind (PROJECT_OPEN_SETTINGS));
8293+
82658294 for (int i = 0 ; i < _init_callbacks.size (); i++) {
82668295 _init_callbacks[i]();
82678296 }
0 commit comments