This commit is contained in:
2025-12-14 11:42:48 +08:00
parent 4aeb3637bf
commit f3f1a1d058
2 changed files with 14 additions and 1 deletions

View File

@@ -68,7 +68,8 @@ export class SyncBase {
if (!filename) return false;
const dir = this.#dir;
const file = path.join(dir, filename);
return { relative: path.relative(dir, file), absolute: file };
const realFilename = path.basename(filename);
return { relative: path.relative(dir, file), absolute: file, filename: realFilename };
}
async canDone(syncType: SyncConfigType, type?: SyncConfigType) {
if (syncType === 'sync') return true;

View File

@@ -196,7 +196,19 @@ const clone = new Command('clone')
const matchList = matchObjectList
.map((item2) => {
const rp = sync.getRelativePath(item2.pathname);
if (!rp) return false;
if (rp.absolute.endsWith('gitignore.txt')) {
// 修改为 .gitignore
const newPath = rp.absolute.replace('gitignore.txt', '.gitignore');
rp.absolute = newPath;
rp.relative = path.relative(sync.dir, newPath);
} else if (rp.absolute.endsWith('.dot')) {
const filename = path.basename(rp.absolute, '.dot');
const newPath = path.join(path.dirname(rp.absolute), `.${filename}`);
rp.absolute = newPath;
rp.relative = path.relative(sync.dir, newPath);
}
return { ...item2, relative: rp.relative, absolute: rp.absolute };
})
.filter((i) => i);