mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-02-01 03:12:15 +00:00
Create dir on desktop only
This commit is contained in:
parent
7ce977bb82
commit
4c8442fa38
@ -162,14 +162,19 @@ impl LightClientConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create directory if it doesn't exist
|
// Create directory if it doesn't exist on non-mobile platforms
|
||||||
match std::fs::create_dir_all(zcash_data_location.clone()) {
|
#[cfg(all(not(target_os="ios"), not(target_os="android")))]
|
||||||
Ok(_) => zcash_data_location.into_boxed_path(),
|
{
|
||||||
Err(e) => {
|
match std::fs::create_dir_all(zcash_data_location.clone()) {
|
||||||
eprintln!("Couldn't create zcash directory!\n{}", e);
|
Ok(_) => {},
|
||||||
panic!("Couldn't create zcash directory!");
|
Err(e) => {
|
||||||
|
eprintln!("Couldn't create zcash directory!\n{}", e);
|
||||||
|
panic!("Couldn't create zcash directory!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zcash_data_location.into_boxed_path()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_wallet_path(&self) -> Box<Path> {
|
pub fn get_wallet_path(&self) -> Box<Path> {
|
||||||
@ -322,9 +327,12 @@ impl LightClient {
|
|||||||
/// Create a brand new wallet with a new seed phrase. Will fail if a wallet file
|
/// Create a brand new wallet with a new seed phrase. Will fail if a wallet file
|
||||||
/// already exists on disk
|
/// already exists on disk
|
||||||
pub fn new(config: &LightClientConfig, latest_block: u64) -> io::Result<Self> {
|
pub fn new(config: &LightClientConfig, latest_block: u64) -> io::Result<Self> {
|
||||||
if config.wallet_exists() {
|
#[cfg(all(not(target_os="ios"), not(target_os="android")))]
|
||||||
return Err(Error::new(ErrorKind::AlreadyExists,
|
{
|
||||||
"Cannot create a new wallet from seed, because a wallet already exists"));
|
if config.wallet_exists() {
|
||||||
|
return Err(Error::new(ErrorKind::AlreadyExists,
|
||||||
|
"Cannot create a new wallet from seed, because a wallet already exists"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut l = LightClient {
|
let mut l = LightClient {
|
||||||
@ -349,9 +357,12 @@ impl LightClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_from_phrase(seed_phrase: String, config: &LightClientConfig, birthday: u64, overwrite: bool) -> io::Result<Self> {
|
pub fn new_from_phrase(seed_phrase: String, config: &LightClientConfig, birthday: u64, overwrite: bool) -> io::Result<Self> {
|
||||||
if !overwrite && config.wallet_exists() {
|
#[cfg(all(not(target_os="ios"), not(target_os="android")))]
|
||||||
return Err(Error::new(ErrorKind::AlreadyExists,
|
{
|
||||||
"Cannot create a new wallet from seed, because a wallet already exists"));
|
if !overwrite && config.wallet_exists() {
|
||||||
|
return Err(Error::new(ErrorKind::AlreadyExists,
|
||||||
|
"Cannot create a new wallet from seed, because a wallet already exists"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut l = LightClient {
|
let mut l = LightClient {
|
||||||
|
Loading…
Reference in New Issue
Block a user