fix(storage): retain explicit junction rejection when binding physical data roots

This commit is contained in:
Agent Workbench Dev
2026-10-31 15:11:38 +08:00
parent 85e0f0e5ce
commit 138adcf33f
2 changed files with 20 additions and 1 deletions
+7 -1
View File
@@ -97,7 +97,13 @@ export class Store extends EventEmitter {
// A retained pre-desktop Store may still name an MSIX-virtualized LocalAppData
// directory. Bind new path-scoped services to that same physical directory,
// including when SQLite is already open; do not reopen or move its data.
this.directory = fs.realpathSync.native(this.directory);
const resolved = path.resolve(this.directory), parsed = path.parse(resolved);
let current = parsed.root;
for (const component of resolved.slice(parsed.root.length).split(path.sep).filter(Boolean)) {
current = path.join(current, component);
if (fs.lstatSync(current).isSymbolicLink()) throw new Error('任务数据目录不接受符号链接或目录联接。');
}
this.directory = fs.realpathSync.native(resolved);
if (this.storage?.database) {
const missing = CORE_KINDS.filter(kind => !this.core?.[kind]);
if (missing.length) {