@@ -42,6 +42,9 @@ static func get_plugin_examples_path() -> String:
4242static func get_app_config_path () -> String :
4343 return get_plugin_path () + APP_CONFIG_RELATIVE_PATH
4444
45+ static func get_scene_loader_path () -> String :
46+ return get_plugin_path () + SCENE_LOADER_RELATIVE_PATH
47+
4548static func get_copy_path () -> String :
4649 var copy_path = ProjectSettings .get_setting (PROJECT_SETTINGS_PATH + "copy_path" , get_plugin_examples_path ())
4750 if not copy_path .ends_with ("/" ):
@@ -192,18 +195,18 @@ func _update_app_config_paths(target_path : String) -> void:
192195 ]
193196 for prefix in prefixes :
194197 prefix += " = \" "
195- var target_string = prefix + get_plugin_examples_path ()
198+ var target_string = prefix + get_plugin_examples_path ()
196199 var replacing_string = prefix + target_path
197200 file_text = file_text .replace (target_string , replacing_string )
198201 var file = FileAccess .open (file_path , FileAccess .WRITE )
199202 file .store_string (file_text )
200203 file .close ()
201204
202205func _update_scene_loader_path (target_path : String ) -> void :
203- var file_path : String = get_plugin_path () + SCENE_LOADER_RELATIVE_PATH
206+ var file_path : String = get_scene_loader_path ()
204207 var file_text : String = FileAccess .get_file_as_string (file_path )
205208 var prefix : String = "loading_screen_path = \" "
206- var target_string = prefix + get_plugin_path () + "base/"
209+ var target_string = prefix + get_plugin_path () + "base/"
207210 var replacing_string = prefix + target_path
208211 file_text = file_text .replace (target_string , replacing_string )
209212 var file = FileAccess .open (file_path , FileAccess .WRITE )
@@ -219,11 +222,29 @@ func _add_translations() -> void:
219222 translations .append (translation_path )
220223 ProjectSettings .set_setting ("internationalization/locale/translations" , translations )
221224
225+ func _is_app_config_path_updated (target_path ) -> bool :
226+ var file_text : String = FileAccess .get_file_as_string (get_app_config_path ())
227+ var target_string = "main_menu_scene_path = \" " + get_plugin_examples_path ()
228+ return ! file_text .contains (target_string )
229+
230+ func _is_scene_loader_path_updated (target_path ) -> bool :
231+ var file_text : String = FileAccess .get_file_as_string (get_scene_loader_path ())
232+ var target_string = "loading_screen_path = \" " + get_plugin_path () + "base/"
233+ return ! file_text .contains (target_string )
234+
235+ func are_autoload_paths_updated () -> bool :
236+ var copy_path := get_copy_path ()
237+ if copy_path == get_plugin_examples_path (): return false
238+ return _is_app_config_path_updated (copy_path ) and _is_scene_loader_path_updated (copy_path )
239+
240+ func update_autoload_paths (target_path : String ) -> void :
241+ _update_app_config_paths (target_path )
242+ _update_scene_loader_path (target_path )
243+
222244func _on_completed_copy_to_directory (target_path : String ) -> void :
223245 ProjectSettings .set_setting (PROJECT_SETTINGS_PATH + "copy_path" , target_path )
224246 ProjectSettings .save ()
225- _update_app_config_paths (target_path )
226- _update_scene_loader_path (target_path )
247+ update_autoload_paths (target_path )
227248 _copy_override_file ()
228249 _open_play_opening_confirmation_dialog (target_path )
229250
0 commit comments