Skip to content

Commit

Permalink
use file system path for copy commands (#12002)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew authored Jan 13, 2023
1 parent 315f2e0 commit 2d08d88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
execute: async uris => {
if (uris.length) {
const lineDelimiter = isWindows ? '\r\n' : '\n';
const text = uris.map(resource => resource.path).join(lineDelimiter);
const text = uris.map(resource => resource.path.fsPath()).join(lineDelimiter);
await this.clipboardService.writeText(text);
} else {
await this.messageService.info('Open a file first to copy its path');
Expand Down
6 changes: 3 additions & 3 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ export class WorkspaceCommandContribution implements CommandContribution {
const text = uris.map((uri: URI) => {
const workspaceRoot = this.workspaceService.getWorkspaceRootUri(uri);
if (workspaceRoot) {
return workspaceRoot.relative(uri);
return workspaceRoot.relative(uri)?.fsPath();
} else {
return uri.path;
return uri.path.fsPath();
}
}).join(lineDelimiter);
await this.clipboardService.writeText(text);
Expand Down Expand Up @@ -425,7 +425,7 @@ export class WorkspaceCommandContribution implements CommandContribution {

protected trimFileName(name: string): string {
if (name && name.length > 30) {
return `${name.substr(0, 30)}...`;
return `${name.substring(0, 30)}...`;
}
return name;
}
Expand Down

0 comments on commit 2d08d88

Please sign in to comment.