mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Remove another unnecessary env_var_t creation
This commit is contained in:
parent
bd7fea55c4
commit
e6d09dc4fe
1 changed files with 7 additions and 6 deletions
|
@ -970,13 +970,14 @@ static expand_error_t expand_stage_wildcards(const wcstring &input, std::vector<
|
|||
} else {
|
||||
// Get the PATH/CDPATH and CWD. Perhaps these should be passed in. An empty CDPATH
|
||||
// implies just the current directory, while an empty PATH is left empty.
|
||||
const wchar_t *name = for_cd ? L"CDPATH" : L"PATH";
|
||||
auto paths = env_get(name);
|
||||
if (paths.missing_or_empty()) {
|
||||
paths = env_var_t(name, for_cd ? L"." : L"");
|
||||
wcstring_list_t paths;
|
||||
if (auto paths_var = env_get(for_cd ? L"CDPATH" : L"PATH")) {
|
||||
paths = paths_var->as_list();
|
||||
}
|
||||
|
||||
for (const wcstring &next_path : paths->as_list()) {
|
||||
if (paths.empty()) {
|
||||
paths.emplace_back(for_cd ? L"." : L"");
|
||||
}
|
||||
for (const wcstring &next_path : paths) {
|
||||
effective_working_dirs.push_back(
|
||||
path_apply_working_directory(next_path, working_dir));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue