replace var_entry_t with env_var_t

This is a step to storing fish vars as actual vectors rather than flat
strings.
This commit is contained in:
Kurtis Rader
2017-08-09 11:11:58 -07:00
parent 745a88f2f6
commit 728a4634a1
11 changed files with 120 additions and 126 deletions

View File

@@ -48,20 +48,18 @@ static bool path_get_path_core(const wcstring &cmd, wcstring *out_path,
}
int err = ENOENT;
wcstring bin_path;
wcstring_list_t pathsv;
if (!bin_path_var.missing()) {
bin_path = bin_path_var.as_string();
bin_path_var.to_list(pathsv);
} else {
// Note that PREFIX is defined in the `Makefile` and is thus defined when this module is
// compiled. This ensures we always default to "/bin", "/usr/bin" and the bin dir defined
// for the fish programs. Possibly with a duplicate dir if PREFIX is empty, "/", "/usr" or
// "/usr/". If the PREFIX duplicates /bin or /usr/bin that is harmless other than a trivial
// amount of time testing a path we've already tested.
bin_path = *list_to_array_val(wcstring_list_t({L"/bin", L"/usr/bin", PREFIX L"/bin"}));
pathsv = wcstring_list_t({L"/bin", L"/usr/bin", PREFIX L"/bin"});
}
wcstring_list_t pathsv;
bin_path_var.to_list(pathsv);
for (auto next_path : pathsv) {
if (next_path.empty()) continue;
append_path_component(next_path, cmd);