File tree 2 files changed +10
-5
lines changed
src/client/pythonEnvironments
discovery/locators/services 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -117,17 +117,22 @@ export async function resolveSymbolicLink(absPath: string): Promise<string> {
117
117
118
118
/**
119
119
* Returns full path to sub directories of a given directory.
120
- * @param root
121
- * @param resolveSymlinks
120
+ * @param {string } root : path to get sub-directories from.
121
+ * @param options : If called with `resolveSymlinks: true`, then symlinks found in
122
+ * the directory are resolved and if they resolve to directories
123
+ * then resolved values are returned.
122
124
*/
123
- export async function * getSubDirs ( root : string , resolveSymlinks : boolean ) : AsyncIterableIterator < string > {
125
+ export async function * getSubDirs (
126
+ root : string ,
127
+ options ?: { resolveSymlinks ?: boolean } ,
128
+ ) : AsyncIterableIterator < string > {
124
129
const dirContents = await fsapi . promises . readdir ( root , { withFileTypes : true } ) ;
125
130
const generators = dirContents . map ( ( item ) => {
126
131
async function * generator ( ) {
127
132
const fullPath = path . join ( root , item . name ) ;
128
133
if ( item . isDirectory ( ) ) {
129
134
yield fullPath ;
130
- } else if ( resolveSymlinks && item . isSymbolicLink ( ) ) {
135
+ } else if ( options ?. resolveSymlinks && item . isSymbolicLink ( ) ) {
131
136
// The current FS item is a symlink. It can potentially be a file
132
137
// or a directory. Resolve it first and then check if it is a directory.
133
138
const resolvedPath = await resolveSymbolicLink ( fullPath ) ;
Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ export function parsePyenvVersion(str: string): Promise<IPyenvVersionStrings | u
259
259
async function * getPyenvEnvironments ( ) : AsyncIterableIterator < PythonEnvInfo > {
260
260
const pyenvVersionDir = getPyenvVersionsDir ( ) ;
261
261
262
- const subDirs = getSubDirs ( pyenvVersionDir , true ) ;
262
+ const subDirs = getSubDirs ( pyenvVersionDir , { resolveSymlinks : true } ) ;
263
263
for await ( const subDirPath of subDirs ) {
264
264
const envDirName = path . basename ( subDirPath ) ;
265
265
const interpreterPath = await getInterpreterPathFromDir ( subDirPath ) ;
You can’t perform that action at this time.
0 commit comments