Only set default fish_function_path when --no-config is used

Otherwise config.fish will keep $fish_function_path.
This commit is contained in:
Fabian Homborg
2021-05-01 19:43:31 +02:00
parent 4fd8673772
commit b16e537b66
3 changed files with 8 additions and 6 deletions

View File

@@ -246,7 +246,7 @@ static void setup_path() {
}
}
void env_init(const struct config_paths_t *paths, bool do_uvars) {
void env_init(const struct config_paths_t *paths, bool do_uvars, bool default_paths) {
env_stack_t &vars = env_stack_t::principal();
// Import environment variables. Walk backwards so that the first one out of any duplicates wins
// (See issue #2784).
@@ -282,9 +282,11 @@ void env_init(const struct config_paths_t *paths, bool do_uvars) {
vars.set_one(FISH_SYSCONFDIR_VAR, ENV_GLOBAL, paths->sysconf);
vars.set_one(FISH_HELPDIR_VAR, ENV_GLOBAL, paths->doc);
vars.set_one(FISH_BIN_DIR, ENV_GLOBAL, paths->bin);
wcstring scstr = paths->data;
scstr.append(L"/functions");
vars.set_one(L"fish_function_path", ENV_GLOBAL, scstr);
if (default_paths) {
wcstring scstr = paths->data;
scstr.append(L"/functions");
vars.set_one(L"fish_function_path", ENV_GLOBAL, scstr);
}
}
// Some `su`s keep $USER when changing to root.