Skip to content

Commit 85b9e88

Browse files
author
Kartik Raj
authored
Fix parent path check (#17274)
* Fix parent path check * only buiild vsix * More verbose logging * Revert "only buiild vsix" This reverts commit b601e59.
1 parent 13d5780 commit 85b9e88

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export abstract class FSWatchingLocator<I = PythonEnvInfo> extends LazyResourceB
143143
const searchLocation = Uri.file(
144144
this.opts.searchLocation ?? path.dirname(getEnvironmentDirFromPath(executable)),
145145
);
146+
traceVerbose('Fired event ', JSON.stringify({ type, kind, searchLocation }), 'from locator');
146147
this.emitter.fire({ type, kind, searchLocation });
147148
};
148149

src/client/pythonEnvironments/common/externalDependencies.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ export function isParentPath(filePath: string, parentPath: string): boolean {
8585
if (!parentPath.endsWith(path.sep)) {
8686
parentPath += path.sep;
8787
}
88+
if (!filePath.endsWith(path.sep)) {
89+
filePath += path.sep;
90+
}
8891
return normCasePath(filePath).startsWith(normCasePath(parentPath));
8992
}
9093

src/client/pythonEnvironments/common/pythonBinariesWatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function watchLocationForPythonBinaries(
2727
const resolvedGlob = path.posix.normalize(executableGlob);
2828
const [baseGlob] = resolvedGlob.split('/').slice(-1);
2929
function callbackClosure(type: FileChangeType, e: string) {
30-
traceVerbose('Received event', JSON.stringify(e), 'for baseglob', baseGlob);
30+
traceVerbose('Received event', type, JSON.stringify(e), 'for baseglob', baseGlob);
3131
const isMatch = minimatch(path.basename(e), baseGlob, { nocase: getOSType() === OSType.Windows });
3232
if (!isMatch) {
3333
// When deleting the file for some reason path to all directories leading up to python are reported

src/client/pythonEnvironments/legacyIOC.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { injectable } from 'inversify';
55
import { intersection } from 'lodash';
66
import * as vscode from 'vscode';
77
import { DiscoveryVariants } from '../common/experiments/groups';
8-
import { traceError } from '../common/logger';
8+
import { traceError, traceVerbose } from '../common/logger';
99
import { FileChangeType } from '../common/platform/fileSystemWatcher';
1010
import { Resource } from '../common/types';
1111
import {
@@ -177,6 +177,7 @@ class ComponentAdapter implements IComponentAdapter {
177177
if (!workspaceFolder || !e.searchLocation) {
178178
return;
179179
}
180+
traceVerbose(`Recieved event ${JSON.stringify(e)} file change event`);
180181
if (
181182
e.type === FileChangeType.Created &&
182183
isParentPath(e.searchLocation.fsPath, workspaceFolder.uri.fsPath)

0 commit comments

Comments
 (0)