Preserve data across the Straywild transition

This commit is contained in:
Alexander Sellite 2026-08-25 22:18:20 -04:00
parent 737d1cf2e0
commit 98a27e2f53
28 changed files with 577 additions and 94 deletions

View file

@ -26,10 +26,7 @@ static func migrate_legacy_to(
) -> Dictionary:
var normalized: String = destination.simplify_path().trim_suffix("/")
if DirAccess.dir_exists_absolute(normalized):
var existing_manifest: String = normalized.path_join(
PlayerDataRoot.MANIFEST_FILENAME
)
if FileAccess.file_exists(existing_manifest):
if data_root.has_data_manifest(normalized):
return {
"ok": false,
"requires_existing_root_decision": true,
@ -106,7 +103,7 @@ static func migrate_active_to(
"message": "This data folder is already active.",
}
if DirAccess.dir_exists_absolute(normalized) and not _directory_empty(normalized):
if FileAccess.file_exists(normalized.path_join(PlayerDataRoot.MANIFEST_FILENAME)):
if data_root.has_data_manifest(normalized):
return {
"ok": false,
"requires_existing_root_decision": true,
@ -207,8 +204,7 @@ static func replace_existing_with_legacy(
destination: String,
) -> Dictionary:
var normalized: String = destination.simplify_path().trim_suffix("/")
var manifest: String = normalized.path_join(PlayerDataRoot.MANIFEST_FILENAME)
if not FileAccess.file_exists(manifest):
if not data_root.has_data_manifest(normalized):
return {"ok": false, "message": "The selected folder is not a straywild data root."}
var recovery: String = ProjectSettings.globalize_path(
"user://migration-recovery"
@ -229,7 +225,7 @@ static func replace_existing_with_active(
destination: String,
) -> Dictionary:
var normalized: String = destination.simplify_path().trim_suffix("/")
if not FileAccess.file_exists(normalized.path_join(PlayerDataRoot.MANIFEST_FILENAME)):
if not data_root.has_data_manifest(normalized):
return {"ok": false, "message": "The selected folder is not a straywild data root."}
var recovery: String = ProjectSettings.globalize_path(
"user://migration-recovery"