提交 f44a1d6e 编写于 作者: C Christof Marti

Use OS path separator when matching glob (fixes #16090)

上级 a8927d1a
......@@ -34,7 +34,7 @@ export interface IWorkspaceContextService {
* without leading or trailing slashes. Returns null if the file is not inside an opened
* workspace.
*/
toWorkspaceRelativePath: (resource: URI) => string;
toWorkspaceRelativePath: (resource: URI, toOSPath?: boolean) => string;
/**
* Given a workspace relative path, returns the resource with the absolute path.
......@@ -89,9 +89,9 @@ export class WorkspaceContextService implements IWorkspaceContextService {
return false;
}
public toWorkspaceRelativePath(resource: URI): string {
public toWorkspaceRelativePath(resource: URI, toOSPath?: boolean): string {
if (this.isInsideWorkspace(resource)) {
return paths.normalize(paths.relative(this.workspace.resource.fsPath, resource.fsPath));
return paths.normalize(paths.relative(this.workspace.resource.fsPath, resource.fsPath), toOSPath);
}
return null;
......
......@@ -602,7 +602,7 @@ export class FileFilter implements IFilter {
// Hide those that match Hidden Patterns
const siblingsFn = () => siblings && siblings.map(c => c.name);
if (glob.match(this.hiddenExpression, this.contextService.toWorkspaceRelativePath(stat.resource), siblingsFn)) {
if (glob.match(this.hiddenExpression, this.contextService.toWorkspaceRelativePath(stat.resource, true), siblingsFn)) {
return false; // hidden through pattern
}
......
......@@ -96,8 +96,8 @@ export class TestContextService implements IWorkspaceContextService {
return false;
}
public toWorkspaceRelativePath(resource: URI): string {
return paths.makePosixAbsolute(paths.normalize(resource.fsPath.substr('c:'.length)));
public toWorkspaceRelativePath(resource: URI, toOSPath?: boolean): string {
return paths.makePosixAbsolute(paths.normalize(resource.fsPath.substr('c:'.length), toOSPath));
}
public toResource(workspaceRelativePath: string): URI {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册