Skip to content

Commit ce1b4be

Browse files
committed
fixes #82149
1 parent 9df03c6 commit ce1b4be

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vs/base/common/resourceTree.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,22 @@ export class ResourceTree<T extends NonNullable<any>, C> {
159159

160160
delete(uri: URI): T | undefined {
161161
const key = relativePath(this.root.uri, uri) || uri.fsPath;
162-
const parts = key.split(/[\\\/]/).filter(p => !!p);
163-
return this._delete(this.root, parts, 0);
162+
const iterator = new PathIterator(false).reset(key);
163+
return this._delete(this.root, iterator);
164164
}
165165

166-
private _delete(node: BranchNode<T, C>, parts: string[], index: number): T | undefined {
167-
const name = parts[index];
166+
private _delete(node: BranchNode<T, C>, iterator: PathIterator): T | undefined {
167+
const name = iterator.value();
168168
const child = node.get(name);
169169

170170
if (!child) {
171171
return undefined;
172172
}
173173

174174
// not at end
175-
if (index < parts.length - 1) {
175+
if (iterator.hasNext()) {
176176
if (child instanceof BranchNode) {
177-
const result = this._delete(child, parts, index + 1);
177+
const result = this._delete(child, iterator.next());
178178

179179
if (typeof result !== 'undefined' && child.size === 0) {
180180
node.delete(name);

0 commit comments

Comments
 (0)