mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-01-30 18:42:15 +00:00
Fix android crash
This commit is contained in:
parent
06a268c2bd
commit
6c0a672d66
@ -146,6 +146,9 @@ impl LightClientConfig {
|
||||
zcash_data_location = dirs::data_dir().expect("Couldn't determine app data directory!");
|
||||
zcash_data_location.push("Zcash");
|
||||
} 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.push(".zcash");
|
||||
};
|
||||
@ -174,6 +177,10 @@ impl LightClientConfig {
|
||||
}
|
||||
|
||||
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();
|
||||
zcash_params.push("..");
|
||||
if cfg!(target_os="macos") || cfg!(target_os="windows") {
|
||||
@ -375,24 +382,26 @@ impl LightClient {
|
||||
self.sapling_spend.extend_from_slice(sapling_spend);
|
||||
}
|
||||
|
||||
// Ensure that the sapling params are stored on disk properly as well.
|
||||
match self.config.get_zcash_params_path() {
|
||||
Ok(zcash_params_dir) => {
|
||||
// Create the sapling output and spend params files
|
||||
match LightClient::write_file_if_not_exists(&zcash_params_dir, "sapling-output.params", &self.sapling_output) {
|
||||
Ok(_) => {},
|
||||
Err(e) => eprintln!("Warning: Couldn't write the output params!\n{}", e)
|
||||
};
|
||||
// Ensure that the sapling params are stored on disk properly as well. Only on desktop
|
||||
if cfg!(all(not(target_os="ios"), not(target_os="android"))) {
|
||||
match self.config.get_zcash_params_path() {
|
||||
Ok(zcash_params_dir) => {
|
||||
// Create the sapling output and spend params files
|
||||
match LightClient::write_file_if_not_exists(&zcash_params_dir, "sapling-output.params", &self.sapling_output) {
|
||||
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(_) => {},
|
||||
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(_) => {},
|
||||
Err(e) => eprintln!("Warning: Couldn't write the output params!\n{}", e)
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
eprintln!("{}", e);
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
eprintln!("{}", e);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user