feat: 支持修改启动器数据目录位置(issue #43) - #44
Open
yukitakasama wants to merge 8 commits into
Open
Conversation
…sue dsh-plugins#43) - migrate.rs: bootstrap resolution chain (env DSH_LAUNCHER_DATA_HOME > pointer file data-home.txt > default app data dir), one-shot migration before the log handle opens: copy config/versions/homes/logs/.pnpm-store/ tools/icons/bin -> verify -> switch -> snapshot old dir as .old-<ts>. Failure rolls back to the default dir and drops the pointer. - AppState gains data_dir_source + data_dir_notice; commands pick_data_dir (blocking folder dialog), commit_data_dir (validate + write pointer), get_data_dir_source (path + source + fallback notice). - lib.rs setup calls migrate::bootstrap before applog::init and ensure_local_node_on_path, so logs/ and tools/ move cleanly. - 4 unit tests for paths_equal/dir_is_empty/copy_tree/tree_stats.
…sh-plugins#43) - Settings.vue: data-dir card gains a 'Change location' button that opens the folder dialog (pick_data_dir), validates + writes the pending pointer file (commit_data_dir), then shows a restart hint modal; the card also displays the current source ('env' / 'pointer' / 'default') and surfaces the startup fallback notice as a toast. - api/index.ts: pickDataDir / commitDataDir / getDataDirSource wired with browser-preview mock branches; types.ts adds DataDirInfo. - i18n: zh-CN + en-US keys for moveTo/restartHint/migrating/migratedToast/ source*/rollback/confirmMove.
…cords (issue dsh-plugins#43) - copy_tree handles file sources (no create_dir_all on files) — fixes os error 267 when migrating config.json. - New tests: migrate_data_dir_copies_and_clears_flag, migrate_data_dir_rejects_non_empty_target, migrate_data_dir_failure_removes_partial_target. - Full suite: 119 passed; tauri build produced exe/msi/nsis bundles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
支持修改启动器数据目录位置(issue #43)。设置页「数据目录」卡片新增「更改位置」入口,重启后自动把现有数据(配置、版本、HOME 目录、日志、npm 缓存、托管 node 等)迁移到新位置;支持
DSH_LAUNCHER_DATA_HOME环境变量覆盖;任一步失败自动回滚,不损坏原数据。变更内容
自举解析链(migrate.rs)
优先级:
DSH_LAUNCHER_DATA_HOME环境变量 > 指针文件<默认app_data_dir>\data-home.txt> 默认目录。迁移状态机
迁移在重启后的启动阶段执行(日志文件句柄打开之前),流程:
MIGRATION_IN_PROGRESS标记(power-failure/杀进程安全,中断后下次启动清理半成品重来)config.json / versions/ / homes/ / logs/ / .pnpm-store/ / tools/ / icons/ / bin/(纯 std::fs 递归,不新增依赖)<dir>.old-<ts>,不直接删除(30 天恢复窗口)新命令
pick_data_dir— 打开目录选择器(tauri-plugin-dialog)commit_data_dir— 校验新目录(非空 / 是否已存在 / 可写)并写入指针文件,不移动文件get_data_dir_source— 返回当前路径 + 来源(env / pointer / default)+ 兜底提示 noticeUI(i18n 双语)
设置页数据目录卡片:来源标识、迁移失败 toast、更改位置按钮 + 重启确认 Modal。
验证
cargo check零告警npx tsc --noEmit零错误pnpm build通过tauri build产出 exe / msi / nsis 三产物DSH_LAUNCHER_DATA_HOME指向临时目录启动,日志确认数据目录解析到该位置附加
docs/ISSUE43_TASK_TREE.md:任务执行记录(6 阶段逐轮回填)。