Skip to content

Commit 844c82b

Browse files
authored
Recursively create parent directories when creating config dir (#3897)
## Motivation When this path is executed from inside a docker container, which we usually run as root, `$HOME` will point to `/root`, but `dirs::config_dir()` will actually return `$HOME/.config`, but the `.config` directory won't be created yet. Then when we call `fs_err::create_dir("/root/.config/linera")`, it can fail because `.config` won't exist yet. ## Proposal Recursively create directories so that `.config` is also created, and the command succeeds from within Docker containers as well. ## Test Plan Deploys were failing with this, now they succeed. ## Release Plan - Nothing to do / These changes follow the usual release cycle.
1 parent 0bd0ef8 commit 844c82b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linera-service/src/linera/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ impl ClientOptions {
15211521
config_dir.push("linera");
15221522
if !config_dir.exists() {
15231523
debug!("Creating default wallet directory {}", config_dir.display());
1524-
fs_err::create_dir(&config_dir)?;
1524+
fs_err::create_dir_all(&config_dir)?;
15251525
}
15261526
info!("Using default wallet directory {}", config_dir.display());
15271527
Ok(config_dir)

0 commit comments

Comments
 (0)