提交 84488994 编写于 作者: J Johannes Rieken

💄 remove unused code, renames

上级 50e579f9
......@@ -300,13 +300,10 @@ function isPosixAbsolute(path: string): boolean {
return path && path[0] === '/';
}
export function makeAbsolute(path: string, isPathNormalized?: boolean): string {
return isPosixAbsolute(!isPathNormalized ? normalize(path) : path) ? path : sep + path;
export function makePosixAbsolute(path: string): string {
return isPosixAbsolute(normalize(path)) ? path : sep + path;
}
export function isRelative(path: string): boolean {
return path && path.length > 1 && path[0] === '.';
}
const _slash = '/'.charCodeAt(0);
const _backslash = '\\'.charCodeAt(0);
......
......@@ -91,12 +91,12 @@ suite('Paths', () => {
});
test('makeAbsolute', () => {
assert.equal(paths.makeAbsolute('foo'), '/foo');
assert.equal(paths.makeAbsolute('foo/bar'), '/foo/bar');
assert.equal(paths.makeAbsolute('foo/bar/'), '/foo/bar/');
assert.equal(paths.makeAbsolute('/foo/bar'), '/foo/bar');
assert.equal(paths.makeAbsolute('/'), '/');
assert.equal(paths.makeAbsolute(''), '/');
assert.equal(paths.makePosixAbsolute('foo'), '/foo');
assert.equal(paths.makePosixAbsolute('foo/bar'), '/foo/bar');
assert.equal(paths.makePosixAbsolute('foo/bar/'), '/foo/bar/');
assert.equal(paths.makePosixAbsolute('/foo/bar'), '/foo/bar');
assert.equal(paths.makePosixAbsolute('/'), '/');
assert.equal(paths.makePosixAbsolute(''), '/');
});
test('basename', () => {
......
......@@ -148,7 +148,7 @@ export class MarkdownFileTracker implements IWorkbenchContribution {
if (markdownConfiguration && types.isArray(markdownConfiguration.styles)) {
newMarkdownConfigurationThumbprint = markdownConfiguration.styles.join('');
let styles: string[] = markdownConfiguration.styles.map((style: string) => paths.makeAbsolute(paths.normalize(style)));
let styles: string[] = markdownConfiguration.styles.map((style: string) => paths.makePosixAbsolute(paths.normalize(style)));
this.markdownConfigurationPaths = styles;
}
}
......
......@@ -113,7 +113,7 @@ export class TestContextService implements WorkspaceContextService.IWorkspaceCon
}
public toWorkspaceRelativePath(resource: URI): string {
return Paths.makeAbsolute(Paths.normalize(resource.fsPath.substr('c:'.length)));
return Paths.makePosixAbsolute(Paths.normalize(resource.fsPath.substr('c:'.length)));
}
public toResource(workspaceRelativePath: string): URI {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册