Skip to content

Commit

Permalink
Avoid prefixing with home when unnecessary (#24232)
Browse files Browse the repository at this point in the history
Fixes #24133

Co-authored-by: Don Jayamanne <[email protected]>
  • Loading branch information
karthiknadig and DonJayamanne authored Oct 3, 2024
1 parent 7455cd5 commit 05e9a5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,10 @@ function getCustomVirtualEnvDirs(): string[] {
const venvFolders = getPythonSettingAndUntildify<string[]>(VENVFOLDERS_SETTING_KEY) ?? [];
const homeDir = getUserHomeDir();
if (homeDir) {
venvFolders.map((item) => path.join(homeDir, item)).forEach((d) => venvDirs.push(d));
venvFolders
.map((item) => (item.startsWith(homeDir) ? item : path.join(homeDir, item)))
.forEach((d) => venvDirs.push(d));
venvFolders.forEach((item) => venvDirs.push(untildify(item)));
}
return Array.from(new Set(venvDirs));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ async function getCustomVirtualEnvDirs(): Promise<string[]> {
const venvFolders = getPythonSetting<string[]>(VENVFOLDERS_SETTING_KEY) ?? [];
const homeDir = getUserHomeDir();
if (homeDir && (await pathExists(homeDir))) {
venvFolders.map((item) => path.join(homeDir, item)).forEach((d) => venvDirs.push(d));
venvFolders
.map((item) => (item.startsWith(homeDir) ? item : path.join(homeDir, item)))
.forEach((d) => venvDirs.push(d));
venvFolders.forEach((item) => venvDirs.push(untildify(item)));
}
return asyncFilter(uniq(venvDirs), pathExists);
}
Expand Down

0 comments on commit 05e9a5b

Please sign in to comment.