Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: copy file on windows #176

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.25.1",
"version": "0.25.2",
"repository": {
"type": "git",
"url": "https://github.com/moshfeu/vscode-compare-folders"
Expand Down
29 changes: 12 additions & 17 deletions src/providers/foldersCompareProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import { CHOOSE_FOLDERS_AND_COMPARE } from '../constants/commands';
import {
chooseFoldersAndCompare,
showDiffs,
compareFolders,
CompareResult,
showFile,
compareFoldersWithLoader,
} from '../services/comparer';
import { File } from '../models/file';
import { build } from '../services/treeBuilder';
Expand Down Expand Up @@ -69,7 +69,7 @@ export class CompareFoldersProvider implements TreeDataProvider<File> {
}
const [{ fsPath: folder1Path }, { fsPath: folder2Path }] = uris;
pathContext.setPaths(folder1Path, folder2Path);
return this.handleDiffResult(await compareFolders());
return this.handleDiffResult(await compareFoldersWithLoader());
};

dismissDifference = async (e: TreeItem) => {
Expand All @@ -85,18 +85,10 @@ export class CompareFoldersProvider implements TreeDataProvider<File> {
}

chooseFoldersAndCompare = async (ignoreWorkspace = false) => {
await window.withProgress(
{
location: ProgressLocation.Notification,
title: `Compare folders...`,
},
async () => {
this.handleDiffResult(
await chooseFoldersAndCompare(
ignoreWorkspace ? undefined : await this.getWorkspaceFolder()
)
);
}
this.handleDiffResult(
await chooseFoldersAndCompare(
ignoreWorkspace ? undefined : await this.getWorkspaceFolder()
)
);
};

Expand Down Expand Up @@ -200,7 +192,7 @@ export class CompareFoldersProvider implements TreeDataProvider<File> {
this.ignoreDifferencesList.clear();
}
try {
this._diffs = (await compareFolders());
this._diffs = (await compareFoldersWithLoader());
this.filterIgnoredFromDiffs();
if (shouldShowInfoMessage && this._diffs.hasResult()) {
showInfoMessageWithTimeout('Source Refreshed');
Expand Down Expand Up @@ -266,8 +258,11 @@ export class CompareFoldersProvider implements TreeDataProvider<File> {
const [folder1Path, folder2Path] = pathContext.getPaths();
const [from, to] =
direction === 'to-compared' ? [folder1Path, folder2Path] : [folder2Path, folder1Path];
const fromPath = uri.fsPath;
const toPath = path.join(to, path.relative(from, fromPath));
const {root, dir, name} = path.parse(from);
const pathWithoutSchema = dir.replace(root, '');
const fileCopiedRelativePath = uri.fsPath.replace(pathWithoutSchema, '').replace(name, '');
const fromPath = path.join(from, fileCopiedRelativePath);
const toPath = path.join(to, fileCopiedRelativePath);
copySync(fromPath, toPath);
this.refresh(false);
} catch (error) {
Expand Down
Loading