From 977d8fa2dda00b45178b18ee3120082c0780b5ad Mon Sep 17 00:00:00 2001 From: edouardparis Date: Wed, 29 May 2024 17:34:16 +0200 Subject: [PATCH] Create datadir before install to store installer.log Launcher is not skipped anymore if no datadir exists the code in main.rs line 138 to create the datadir needs to be duplicated in this case. --- gui/src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gui/src/main.rs b/gui/src/main.rs index 087fd48a..a3bc0c8f 100644 --- a/gui/src/main.rs +++ b/gui/src/main.rs @@ -199,6 +199,18 @@ impl Application for GUI { } (State::Launcher(l), Message::Launch(msg)) => match *msg { launcher::Message::Install(datadir_path, network) => { + if !datadir_path.exists() { + // datadir is created right before launching the installer + // so logs can go in /installer.log + if let Err(e) = create_datadir(&datadir_path) { + error!("Failed to create datadir: {}", e); + } else { + info!( + "Created a fresh data directory at {}", + &datadir_path.to_string_lossy() + ); + } + } self.logger.set_installer_mode( datadir_path.clone(), self.log_level.unwrap_or(LevelFilter::INFO),