mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-28 21:41:15 -03:00
Remove some unnecessary env_var_t usage
This commit is contained in:
14
src/path.cpp
14
src/path.cpp
@@ -180,12 +180,14 @@ bool path_get_cdpath(const wcstring &dir, wcstring *out, const wchar_t *wd,
|
||||
paths.push_back(path);
|
||||
} else {
|
||||
// Respect CDPATH.
|
||||
auto cdpaths = env_vars.get(L"CDPATH");
|
||||
if (cdpaths.missing_or_empty()) cdpaths = env_var_t(L"CDPATH", L".");
|
||||
|
||||
std::vector<wcstring> cdpathsv;
|
||||
cdpaths->to_list(cdpathsv);
|
||||
for (auto next_path : cdpathsv) {
|
||||
wcstring_list_t cdpathsv;
|
||||
if (auto cdpaths = env_vars.get(L"CDPATH")) {
|
||||
cdpathsv = cdpaths->as_list();
|
||||
}
|
||||
if (cdpathsv.empty()) {
|
||||
cdpathsv.push_back(L".");
|
||||
}
|
||||
for (wcstring next_path : cdpathsv) {
|
||||
if (next_path.empty()) next_path = L".";
|
||||
if (next_path == L"." && wd != NULL) {
|
||||
// next_path is just '.', and we have a working directory, so use the wd instead.
|
||||
|
||||
Reference in New Issue
Block a user