SubGameDirectoryStore.keyPrefix 也加 nonisolated

之前只把 3 个 method 标 nonisolated,漏了 keyPrefix 静态常量。actor 内的
ensureReady 访问 method 时跨 actor 拿到 keyPrefix 会触发 MainActor 隔离检查
失败(SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor 项目设置下,未标注则默认
MainActor)。补 nonisolated。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
joywayer
2026-06-23 23:07:23 +08:00
co-authored by Claude Opus 4.7
parent 7be7a2abbc
commit 6ef90f9c3f
@@ -16,7 +16,7 @@ import Foundation
/// UserDefaults 线程安全,所有方法 nonisolated 让 actor / MainActor / 后台线程都能直接调用。
public enum SubGameDirectoryStore {
private static let keyPrefix = "ylgh.subGameDir."
nonisolated private static let keyPrefix = "ylgh.subGameDir."
/// 当前实际目录名。已持久化 → 返回持久化值;未持久化 → 返回 directory 本身
/// (对应 msext NSUserDefaults 缺 key 时 gamefilepath = gamename 的默认)。