Skip to content

Commit

Permalink
Avoid prefixing with home when unnecessary (#24230)
Browse files Browse the repository at this point in the history
Fixes #24133
  • Loading branch information
DonJayamanne authored Oct 3, 2024
1 parent 3e7d8e1 commit d072503
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 d072503

Please sign in to comment.