File tree Expand file tree Collapse file tree
src/client/interpreter/locators Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Use node FS APIs when searching for python. This is a temporary change until VSC FS APIs are fixed.
Original file line number Diff line number Diff line change 1+ import * as fsapi from 'fs-extra' ;
12import { inject , injectable } from 'inversify' ;
23import * as path from 'path' ;
34import { traceError } from '../../common/logger' ;
@@ -8,13 +9,15 @@ import { IPipEnvServiceHelper } from './types';
89
910const CheckPythonInterpreterRegEx = IS_WINDOWS ? / ^ p y t h o n ( \d + ( .\d + ) ? ) ? \. e x e $ / : / ^ p y t h o n ( \d + ( .\d + ) ? ) ? $ / ;
1011
11- export async function lookForInterpretersInDirectory ( pathToCheck : string , fs : IFileSystem ) : Promise < string [ ] > {
12+ export async function lookForInterpretersInDirectory ( pathToCheck : string , _ : IFileSystem ) : Promise < string [ ] > {
1213 // Technically, we should be able to use fs.getFiles(). However,
1314 // that breaks some tests. So we stick with the broader behavior.
1415 try {
15- const subDirs = await fs . listdir ( pathToCheck ) ;
16- return subDirs
17- . map ( ( [ filename , _ft ] ) => filename )
16+ // tslint:disable-next-line: no-suspicious-comment
17+ // TODO https://github.com/microsoft/vscode-python/issues/11338
18+ const files = await fsapi . readdir ( pathToCheck ) ;
19+ return files
20+ . map ( ( filename ) => path . join ( pathToCheck , filename ) )
1821 . filter ( ( fileName ) => CheckPythonInterpreterRegEx . test ( path . basename ( fileName ) ) ) ;
1922 } catch ( err ) {
2023 traceError ( 'Python Extension (lookForInterpretersInDirectory.fs.listdir):' , err ) ;
You can’t perform that action at this time.
0 commit comments