mirror of
https://github.com/danbulant/nushell
synced 2026-05-24 12:35:59 +00:00
Create config directory if it does not exist (#625)
Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
parent
56ae07adb9
commit
15b0424d73
1 changed files with 15 additions and 7 deletions
|
|
@ -265,6 +265,13 @@ fn main() -> Result<()> {
|
|||
// Load config startup file
|
||||
if let Some(mut config_path) = nu_path::config_dir() {
|
||||
config_path.push("nushell");
|
||||
|
||||
// Create config directory if it does not exist
|
||||
if !config_path.exists() {
|
||||
if let Err(err) = std::fs::create_dir_all(&config_path) {
|
||||
eprintln!("Failed to create config directory: {}", err);
|
||||
}
|
||||
} else {
|
||||
config_path.push("config.nu");
|
||||
|
||||
if config_path.exists() {
|
||||
|
|
@ -277,6 +284,7 @@ fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the config
|
||||
let config = match stack.get_config() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue