feat: add portable directory safeguards

This commit is contained in:
QiuSW
2026-07-28 00:12:29 +08:00
parent 92091a6690
commit 733954ddc8
15 changed files with 914 additions and 95 deletions
+4 -4
View File
@@ -3,7 +3,7 @@ id: T-407
title: 便携默认目录、实例名称唯一与启动目录预检
phase: 4
deps: [T-403, T-404, T-405]
status: DOING
status: DONE
created: 2026-07-27
owner: codex
---
@@ -29,7 +29,7 @@ owner: codex
## 执行记录
- 状态:DOING
- 变更:已完成需求、架构、API、用户故事、交互清单和原型验收场景定义;待提交文档后实现。
- 验证:待执行。
- 状态:DONE
- 变更:配置保存 portable/custom 目录来源,并按实际 `chub.exe` 同级目录解析 `user_data_dirs` 与 `logs`;历史内置目录安全迁移 portable。设置页展示来源、支持目录选择与“恢复程序目录默认”,日志目录会在后台创建、探测并写入 `chub.log`,不回退 cwd。新建默认目录改为 `instance-<安全实例名>-<短 ID>`;新建/编辑和配置存储均校验名称的 Windows 安全性及大小写无关唯一性。启动 adapter 在 launcher 前创建并验证指定 User Data Dir 可写,失败时不启动浏览器。
- 验证:`go test ./...`、`go vet ./...`、`go test -race ./cmd/chub ./internal/ui ./internal/platform/config ./internal/platform/files`、`cmd /c build.bat` 均通过。
- 阻塞:无。