Rename the game to Emberwild (data copied from the old folder)

This commit is contained in:
Paul Bailey
2026-11-04 15:45:10 +00:00
parent ae2592822e
commit d489bb57ed
7 changed files with 67 additions and 8 deletions

52
scripts/core/boot.gd Normal file
View File

@@ -0,0 +1,52 @@
extends Node
## Autoload "Boot", first in the list: one-off start-up housekeeping that has
## to happen before anything reads user://.
##
## The game was called "Valheimlike" until it became "Emberwild". Godot names
## the user-data folder after the project, so the rename moved it from
## .../app_userdata/Valheimlike to .../app_userdata/Emberwild. The first time
## Emberwild starts, this copies saved worlds, your identity (key, name, look)
## and server settings across. It copies rather than moves, so the old folder
## stays as a backup, and it never overwrites anything already in the new
## folder. Test folders (test_*) and logs are skipped.
const OLD_NAME := "Valheimlike"
const MARKER := "migrated_from_valheimlike.txt"
const SKIP := ["logs", "shader_cache", "vulkan", "test_worlds", "test_net"]
var copied := 0
func _enter_tree() -> void:
migrate_user_data()
## Returns the number of files copied (0 if there was nothing to do).
func migrate_user_data() -> int:
var new_dir := OS.get_user_data_dir()
var old_dir := new_dir.get_base_dir().path_join(OLD_NAME)
if new_dir == old_dir or not DirAccess.dir_exists_absolute(old_dir):
return 0
if FileAccess.file_exists(new_dir.path_join(MARKER)):
return 0
copied = 0
_copy_tree(old_dir, new_dir)
var f := FileAccess.open(new_dir.path_join(MARKER), FileAccess.WRITE)
if f != null:
f.store_string("Copied %d files from %s on %s. The old folder was left as it was.\n" % [
copied, old_dir, Time.get_datetime_string_from_system()])
if copied > 0:
print("[boot] moved to the new name: copied %d files from %s" % [copied, old_dir])
return copied
func _copy_tree(from: String, to: String) -> void:
DirAccess.make_dir_recursive_absolute(to)
var da := DirAccess.open(from)
if da == null:
return
for f in da.get_files():
var dst := to.path_join(f)
if not FileAccess.file_exists(dst) and DirAccess.copy_absolute(from.path_join(f), dst) == OK:
copied += 1
for d in da.get_directories():
if d in SKIP or d.begins_with("test_"):
continue
_copy_tree(from.path_join(d), to.path_join(d))

View File

@@ -6,7 +6,7 @@ extends RefCounted
const DEFAULT_PATH := "user://server/server.json"
const DEFAULTS := {
"server_name": "Valheimlike server",
"server_name": "Emberwild server",
"motd": "Welcome!",
"port": 24242,
"max_players": 8,

View File

@@ -75,7 +75,7 @@ func _ready() -> void:
col.offset_right = 520
col.add_theme_constant_override("separation", 14)
root.add_child(col)
col.add_child(UITheme.label("VALHEIMLIKE", 54))
col.add_child(UITheme.label("EMBERWILD", 54))
col.add_child(UITheme.label("Survive the island. Build a home.", 18, UITheme.TEXT_DIM))
var spacer := Control.new()
spacer.custom_minimum_size = Vector2(0, 24)