mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-07-31 12:21:25 +00:00
Fix android crash
This commit is contained in:
@@ -146,6 +146,9 @@ impl LightClientConfig {
|
|||||||
zcash_data_location = dirs::data_dir().expect("Couldn't determine app data directory!");
|
zcash_data_location = dirs::data_dir().expect("Couldn't determine app data directory!");
|
||||||
zcash_data_location.push("Zcash");
|
zcash_data_location.push("Zcash");
|
||||||
} else {
|
} else {
|
||||||
|
if dirs::home_dir().is_none() {
|
||||||
|
info!("Couldn't determine home dir!");
|
||||||
|
}
|
||||||
zcash_data_location = dirs::home_dir().expect("Couldn't determine home directory!");
|
zcash_data_location = dirs::home_dir().expect("Couldn't determine home directory!");
|
||||||
zcash_data_location.push(".zcash");
|
zcash_data_location.push(".zcash");
|
||||||
};
|
};
|
||||||
@@ -174,6 +177,10 @@ impl LightClientConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_zcash_params_path(&self) -> io::Result<Box<Path>> {
|
pub fn get_zcash_params_path(&self) -> io::Result<Box<Path>> {
|
||||||
|
if dirs::home_dir().is_none() {
|
||||||
|
return Err(io::Error::new(io::ErrorKind::InvalidData, "Couldn't determine Home Dir"));
|
||||||
|
}
|
||||||
|
|
||||||
let mut zcash_params = self.get_zcash_data_path().into_path_buf();
|
let mut zcash_params = self.get_zcash_data_path().into_path_buf();
|
||||||
zcash_params.push("..");
|
zcash_params.push("..");
|
||||||
if cfg!(target_os="macos") || cfg!(target_os="windows") {
|
if cfg!(target_os="macos") || cfg!(target_os="windows") {
|
||||||
@@ -375,24 +382,26 @@ impl LightClient {
|
|||||||
self.sapling_spend.extend_from_slice(sapling_spend);
|
self.sapling_spend.extend_from_slice(sapling_spend);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the sapling params are stored on disk properly as well.
|
// Ensure that the sapling params are stored on disk properly as well. Only on desktop
|
||||||
match self.config.get_zcash_params_path() {
|
if cfg!(all(not(target_os="ios"), not(target_os="android"))) {
|
||||||
Ok(zcash_params_dir) => {
|
match self.config.get_zcash_params_path() {
|
||||||
// Create the sapling output and spend params files
|
Ok(zcash_params_dir) => {
|
||||||
match LightClient::write_file_if_not_exists(&zcash_params_dir, "sapling-output.params", &self.sapling_output) {
|
// Create the sapling output and spend params files
|
||||||
Ok(_) => {},
|
match LightClient::write_file_if_not_exists(&zcash_params_dir, "sapling-output.params", &self.sapling_output) {
|
||||||
Err(e) => eprintln!("Warning: Couldn't write the output params!\n{}", e)
|
Ok(_) => {},
|
||||||
};
|
Err(e) => eprintln!("Warning: Couldn't write the output params!\n{}", e)
|
||||||
|
};
|
||||||
match LightClient::write_file_if_not_exists(&zcash_params_dir, "sapling-spend.params", &self.sapling_spend) {
|
|
||||||
Ok(_) => {},
|
match LightClient::write_file_if_not_exists(&zcash_params_dir, "sapling-spend.params", &self.sapling_spend) {
|
||||||
Err(e) => eprintln!("Warning: Couldn't write the output params!\n{}", e)
|
Ok(_) => {},
|
||||||
|
Err(e) => eprintln!("Warning: Couldn't write the output params!\n{}", e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("{}", e);
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
Err(e) => {
|
}
|
||||||
eprintln!("{}", e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user