Fix incomplete build in case of the machine is offline (#935)
This commit is contained in:
parent
70e39cc6a1
commit
8c716b2e92
@ -8,23 +8,29 @@ use std::path::PathBuf;
|
|||||||
const TESTNET_ID: &str = "testnet5";
|
const TESTNET_ID: &str = "testnet5";
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match get_all_files() {
|
if !base_dir().exists() {
|
||||||
Ok(()) => (),
|
std::fs::create_dir_all(base_dir()).expect(&format!("Unable to create {:?}", base_dir()));
|
||||||
Err(e) => panic!(e),
|
|
||||||
|
match get_all_files() {
|
||||||
|
Ok(()) => (),
|
||||||
|
Err(e) => {
|
||||||
|
std::fs::remove_dir_all(base_dir()).expect(&format!(
|
||||||
|
"{}. Failed to remove {:?}, please remove the directory manually because it may contains incomplete testnet data.",
|
||||||
|
e,
|
||||||
|
base_dir(),
|
||||||
|
));
|
||||||
|
panic!(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_all_files() -> Result<(), String> {
|
pub fn get_all_files() -> Result<(), String> {
|
||||||
if !base_dir().exists() {
|
get_file("boot_enr.yaml")?;
|
||||||
std::fs::create_dir_all(base_dir())
|
get_file("config.yaml")?;
|
||||||
.map_err(|e| format!("Unable to create {:?}: {}", base_dir(), e))?;
|
get_file("deploy_block.txt")?;
|
||||||
|
get_file("deposit_contract.txt")?;
|
||||||
get_file("boot_enr.yaml")?;
|
get_file("genesis.ssz")?;
|
||||||
get_file("config.yaml")?;
|
|
||||||
get_file("deploy_block.txt")?;
|
|
||||||
get_file("deposit_contract.txt")?;
|
|
||||||
get_file("genesis.ssz")?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user