From e285e712f102fc692c1e6598d1b64f26049c5655 Mon Sep 17 00:00:00 2001 From: Mosh Feu Date: Wed, 17 Jan 2024 22:04:23 +0200 Subject: [PATCH] fix(copy-to-folder): error when copy to a folder with a dot (#139) fix #136 See https://github.com/nodejs/node/issues/6229#issuecomment-1879742348 --- package.json | 2 +- src/providers/foldersCompareProvider.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7354b86..4917b39 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "compare-folders", "displayName": "Compare Folders", "description": "Compare folders by contents, present the files that have differences and display the diffs side by side", - "version": "0.24.1", + "version": "0.24.2", "repository": { "type": "git", "url": "https://github.com/moshfeu/vscode-compare-folders" diff --git a/src/providers/foldersCompareProvider.ts b/src/providers/foldersCompareProvider.ts index d55a7a4..3580394 100644 --- a/src/providers/foldersCompareProvider.ts +++ b/src/providers/foldersCompareProvider.ts @@ -256,9 +256,9 @@ export class CompareFoldersProvider implements TreeDataProvider { const [folder1Path, folder2Path] = pathContext.getPaths(); const [from, to] = direction === 'to-compared' ? [folder1Path, folder2Path] : [folder2Path, folder1Path]; - const { root, dir, name } = path.parse(from); + const { root, dir, base } = path.parse(from); const pathWithoutSchema = dir.replace(root, ''); - const fileCopiedRelativePath = uri.fsPath.replace(pathWithoutSchema, '').replace(name, ''); + const fileCopiedRelativePath = uri.fsPath.replace(pathWithoutSchema, '').replace(base, ''); const fromPath = path.join(from, fileCopiedRelativePath); const toPath = path.join(to, fileCopiedRelativePath); copySync(fromPath, toPath);