mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Only set default fish_function_path when --no-config is used
Otherwise config.fish will keep $fish_function_path.
This commit is contained in:
parent
4fd8673772
commit
b16e537b66
10
src/env.cpp
10
src/env.cpp
|
@ -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.
|
||||
|
|
|
@ -80,7 +80,7 @@ struct statuses_t {
|
|||
};
|
||||
|
||||
/// Initialize environment variable data.
|
||||
void env_init(const struct config_paths_t *paths = nullptr, bool do_uvars = true);
|
||||
void env_init(const struct config_paths_t *paths = nullptr, bool do_uvars = true, bool default_paths = false);
|
||||
|
||||
/// Various things we need to initialize at run-time that don't really fit any of the other init
|
||||
/// routines.
|
||||
|
|
|
@ -480,7 +480,7 @@ int main(int argc, char **argv) {
|
|||
paths = determine_config_directory_paths(argv[0]);
|
||||
}
|
||||
if (!opts.no_exec) {
|
||||
env_init(&paths, !opts.no_config);
|
||||
env_init(&paths, /* do uvars */ !opts.no_config, /* default paths */ opts.no_config);
|
||||
}
|
||||
|
||||
// Set features early in case other initialization depends on them.
|
||||
|
|
Loading…
Reference in New Issue
Block a user