diff --git a/fix-conflicts.ts b/fix-conflicts.ts index eb0e970..38293d8 100644 --- a/fix-conflicts.ts +++ b/fix-conflicts.ts @@ -19,7 +19,7 @@ import { join } from "https://deno.land/std@0.173.0/path/mod.ts"; p.close(); const outputStr = (new TextDecoder()).decode(output); - const fileNames = [...new Set(outputStr.split('\n').filter(s => !!s))].map(s => join(backupDir, s)); + const fileNames = [...new Set(outputStr.split('\n').filter(s => !!s))]; const totalFiles = fileNames.length; let filesSuccess = 0; @@ -28,13 +28,14 @@ import { join } from "https://deno.land/std@0.173.0/path/mod.ts"; for (let i = 0; i < totalFiles; i += BATCH_SIZE) { fileData = [ ...fileData, - ...(await Promise.all(fileNames.slice(i, i + BATCH_SIZE).map(async (conflictedFileName) => { + ...(await Promise.all(fileNames.slice(i, i + BATCH_SIZE).map(async (relativeConflictedFileName) => { + const conflictedFileName = join(backupDir, relativeConflictedFileName); const conflictedNameMatch = conflictedFileName.match(CONFLICTED_COPY_REGEX); if (!conflictedNameMatch) { return `[${conflictedFileName}] encountered regex error`; } const conflictString = conflictedNameMatch[1]; - const nonConflictedFileName = join(mainDir, conflictedFileName.replace(conflictString, '')); + const nonConflictedFileName = join(mainDir, relativeConflictedFileName.replace(conflictString, '')); const conflictedFile = await Deno.open(conflictedFileName, { read: true }); const conflictedFileInfo = await Deno.fstat(conflictedFile.rid);