Add current exe directory to default $NU_PLUGIN_DIRS (#15380)

Quality-of-life improvement - Since core plugins are installed into the
same directory as the Nushell binary, this simply adds that directory to
the default `$NU_PLUGIN_DIRS`.

User-facing changes:

The default directory for core plugins is automatically added to the
`$NU.PLUGIN_DIRS` with no user action necessary. Uses can immediately,
out-of-the-box:

```nushell
plugin add nu_plugin_polars
plugin use polars
```
This commit is contained in:
Douglas 2025-03-24 08:27:02 -04:00 committed by GitHub
parent f33a26123c
commit 6aed1b42ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,9 +167,10 @@ fn main() -> Result<()> {
);
working_set.set_variable_const_val(
var_id,
Value::test_list(vec![Value::test_string(
default_nu_plugin_dirs_path.to_string_lossy(),
)]),
Value::test_list(vec![
Value::test_string(default_nu_plugin_dirs_path.to_string_lossy()),
Value::test_string(current_exe_directory().to_string_lossy()),
]),
);
engine_state.merge_delta(working_set.render())?;
// End: Default NU_LIB_DIRS, NU_PLUGIN_DIRS