+ title={new URI(node.fileUri).path.fsPath()}>
diff --git a/packages/workspace/src/browser/workspace-frontend-contribution.ts b/packages/workspace/src/browser/workspace-frontend-contribution.ts
index 2f0338386ee6b..8c2b92f69390a 100644
--- a/packages/workspace/src/browser/workspace-frontend-contribution.ts
+++ b/packages/workspace/src/browser/workspace-frontend-contribution.ts
@@ -440,7 +440,7 @@ export class WorkspaceFrontendContribution implements CommandContribution, Keybi
await this.workspaceService.save(selected);
return true;
} catch {
- this.messageService.error(nls.localizeByDefault("Unable to save workspace '{0}'", selected.path.toString()));
+ this.messageService.error(nls.localizeByDefault("Unable to save workspace '{0}'", selected.path.fsPath()));
}
}
return false;
diff --git a/packages/workspace/src/browser/workspace-input-dialog.ts b/packages/workspace/src/browser/workspace-input-dialog.ts
index d3fe50e39fc2f..bdff19779b746 100644
--- a/packages/workspace/src/browser/workspace-input-dialog.ts
+++ b/packages/workspace/src/browser/workspace-input-dialog.ts
@@ -51,7 +51,7 @@ export class WorkspaceInputDialog extends SingleTextInputDialog {
icon.style.marginRight = '0.5em';
icon.style.verticalAlign = 'middle';
element.style.verticalAlign = 'middle';
- element.title = this.props.parentUri.path.toString();
+ element.title = this.props.parentUri.path.fsPath();
element.appendChild(icon);
element.appendChild(document.createTextNode(label));
// Add the path and icon div before the `inputField`.
diff --git a/packages/workspace/src/browser/workspace-uri-contribution.spec.ts b/packages/workspace/src/browser/workspace-uri-contribution.spec.ts
index 6bf27a6acccf4..65c2e341bbe4a 100644
--- a/packages/workspace/src/browser/workspace-uri-contribution.spec.ts
+++ b/packages/workspace/src/browser/workspace-uri-contribution.spec.ts
@@ -32,6 +32,7 @@ import { FileStat } from '@theia/filesystem/lib/common/files';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import { MockEnvVariablesServerImpl } from '@theia/core/lib/browser/test/mock-env-variables-server';
import { FileUri } from '@theia/core/lib/node';
+import { OS } from '@theia/core/lib/common/os';
import * as temp from 'temp';
after(() => disableJSDOM());
@@ -155,20 +156,35 @@ describe('WorkspaceUriLabelProviderContribution class', () => {
it('should return the absolute path of a file from the file\'s URI if the file is not in the workspace', () => {
const file = new URI('file:///tmp/prout.txt');
const longName = labelProvider.getLongName(file);
- expect(longName).eq('/tmp/prout.txt');
+
+ if (OS.backend.isWindows) {
+ expect(longName).eq('\\tmp\\prout.txt');
+ } else {
+ expect(longName).eq('/tmp/prout.txt');
+ }
});
it('should return the absolute path of a file from the file\'s FileStat if the file is not in the workspace', () => {
const file: FileStat = FileStat.file('file:///tmp/prout.txt');
const longName = labelProvider.getLongName(file);
- expect(longName).eq('/tmp/prout.txt');
+
+ if (OS.backend.isWindows) {
+ expect(longName).eq('\\tmp\\prout.txt');
+ } else {
+ expect(longName).eq('/tmp/prout.txt');
+ }
});
it('should return the path of a file if WorkspaceService returns no roots', () => {
roots = [];
const file = new URI('file:///tmp/prout.txt');
const longName = labelProvider.getLongName(file);
- expect(longName).eq('/tmp/prout.txt');
+
+ if (OS.backend.isWindows) {
+ expect(longName).eq('\\tmp\\prout.txt');
+ } else {
+ expect(longName).eq('/tmp/prout.txt');
+ }
});
});