diff --git a/src/vs/workbench/contrib/files/browser/fileCommands.ts b/src/vs/workbench/contrib/files/browser/fileCommands.ts index d834b54f85aaa..7a57e7ccb92e4 100644 --- a/src/vs/workbench/contrib/files/browser/fileCommands.ts +++ b/src/vs/workbench/contrib/files/browser/fileCommands.ts @@ -275,7 +275,14 @@ CommandsRegistry.registerCommand({ async function resourcesToClipboard(resources: URI[], relative: boolean, clipboardService: IClipboardService, labelService: ILabelService, configurationService: IConfigurationService): Promise { if (resources.length) { const lineDelimiter = isWindows ? '\r\n' : '\n'; - const separator = relative ? configurationService.getValue<'/' | '\\' | undefined>('explorer.copyRelativePathSeparator') : undefined; + + let separator: '/' | '\\' | undefined = undefined; + if (relative) { + const relativeSeparator = configurationService.getValue('explorer.copyRelativePathSeparator'); + if (relativeSeparator === '/' || relativeSeparator === '\\') { + separator = relativeSeparator; + } + } const text = resources.map(resource => labelService.getUriLabel(resource, { relative, noPrefix: true, separator })).join(lineDelimiter); await clipboardService.writeText(text); diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts index 6b5c655053128..6e87acfd99b1b 100644 --- a/src/vs/workbench/contrib/files/browser/files.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts @@ -407,13 +407,16 @@ configurationRegistry.registerConfiguration({ 'type': 'string', 'enum': [ '/', - '\\' + '\\', + 'auto' ], 'enumDescriptions': [ nls.localize('copyRelativePathSeparator.slash', "Use slash as path separation character."), nls.localize('copyRelativePathSeparator.backslash', "Use backslash as path separation character."), + nls.localize('copyRelativePathSeparator.auto', "Uses operating system specific path separation character."), ], - 'description': nls.localize('copyRelativePathSeparator', "The path separation character used when copying relative file paths. Will use the operating system default unless specified."), + 'description': nls.localize('copyRelativePathSeparator', "The path separation character used when copying relative file paths."), + 'default': 'auto' } } });