Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(task-copy): 同名序号不设上限,不因已有副本多而改落点

Dash7ebb8906c4a6
diff --git a/apps/desktop/src/main/task-migration/service.ts b/apps/desktop/src/main/task-migration/service.ts
index 6c143deb57..ebf8c2bfa9 100644
--- a/apps/desktop/src/main/task-migration/service.ts
+++ b/apps/desktop/src/main/task-migration/service.ts
@@ -409,7 +409,8 @@ async function createWorkingDir(places: Placement[]): Promise<{ dir: string; pla
for (const place of places) {
try {
await place.prepare();
- for (let n = 1; n <= 100; n++) {
+ // Each EEXIST is another existing entry, so numbering ends within the folder's entries.
+ for (let n = 1; ; n++) {
const dir = path.join(place.parent, n === 1 ? place.name : `${place.name} ${n}`);
try {
await fs.mkdir(dir);
@@ -418,7 +419,6 @@ async function createWorkingDir(places: Placement[]): Promise<{ dir: string; pla
if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error;
}
}
- throw new Error('MIGRATION_TARGET_UNKNOWN');
} catch (error) {
failure = error;
}