diff --git a/cli/src/lib.rs b/cli/src/lib.rs index d4b9943..5d28aae 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -75,11 +75,11 @@ pub fn report_permission_error() { eprintln!("HOME: {}", home); eprintln!("Executable: {}", current_executable.display()); if home == "/" { - eprintln!("User {} must have permission to write to '{}silentdragonlite/' .", + eprintln!("User {} must have permission to write to '{}.silentdragonlite/' .", user, home); } else { - eprintln!("User {} must have permission to write to '{}/silentdragonlite/' .", + eprintln!("User {} must have permission to write to '{}/.silentdragonlite/' .", user, home); } @@ -89,7 +89,7 @@ pub fn report_permission_error() { pub fn get_log_config(config: &LightClientConfig) -> io::Result { let window_size = 3; // log0, log1, log2 let fixed_window_roller = - FixedWindowRoller::builder().build("Silentdragonlite-light-wallet-log{}",window_size).unwrap(); + FixedWindowRoller::builder().build("Silentdragonlite-wallet-log{}",window_size).unwrap(); let size_limit = 5 * 1024 * 1024; // 5MB as max log file size to roll let size_trigger = SizeTrigger::new(size_limit); let compound_policy = CompoundPolicy::new(Box::new(size_trigger),Box::new(fixed_window_roller)); diff --git a/lib/src/lightclient.rs b/lib/src/lightclient.rs index fb6db3f..bd443de 100644 --- a/lib/src/lightclient.rs +++ b/lib/src/lightclient.rs @@ -27,7 +27,7 @@ use crate::ANCHOR_OFFSET; mod checkpoints; -pub const DEFAULT_SERVER: &str = "https://"; +pub const DEFAULT_SERVER: &str = "https://hush-lightwallet.de:443"; pub const WALLET_NAME: &str = "silentdragonlite-wallet.dat"; pub const LOGFILE_NAME: &str = "silentdragonlite-wallet.debug.log"; @@ -110,7 +110,7 @@ impl LightClientConfig { zcash_data_location.push("silentdragonlite"); } else { zcash_data_location = dirs::home_dir().expect("Couldn't determine home directory!"); - zcash_data_location.push("silentdragonlite/"); + zcash_data_location.push(".silentdragonlite"); }; match &self.chain_name[..] { @@ -120,8 +120,15 @@ impl LightClientConfig { c => panic!("Unknown chain {}", c), }; } - - zcash_data_location.into_boxed_path() + + // Create directory if it doesn't exist + match std::fs::create_dir_all(zcash_data_location.clone()) { + Ok(_) => zcash_data_location.into_boxed_path(), + Err(e) => { + eprintln!("Couldn't create zcash directory!\n{}", e); + panic!("Couldn't create zcash directory!"); + } + } } pub fn get_wallet_path(&self) -> Box { diff --git a/lib/src/lightwallet/startup_helpers.rs b/lib/src/lightwallet/startup_helpers.rs deleted file mode 100644 index d8b7cf2..0000000 --- a/lib/src/lightwallet/startup_helpers.rs +++ /dev/null @@ -1,20 +0,0 @@ -pub fn report_permission_error() { - let user = std::env::var("USER").expect( - "Unexpected error reading value of $USER!"); - let home = std::env::var("HOME").expect( - "Unexpected error reading value of $HOME!"); - let current_executable = std::env::current_exe() - .expect("Unexpected error reporting executable path!"); - eprintln!("USER: {}", user); - eprintln!("HOME: {}", home); - eprintln!("Executable: {}", current_executable.display()); - if home == "/" { - eprintln!("User {} must have permission to write to '{}silentdragonlite/' .", - user, - home); - } else { - eprintln!("User {} must have permission to write to '{}/silentdragonlite/ .", - user, - home); - } -} \ No newline at end of file diff --git a/lib/src/startup_helpers.rs b/lib/src/startup_helpers.rs deleted file mode 100644 index a3cbaf7..0000000 --- a/lib/src/startup_helpers.rs +++ /dev/null @@ -1,20 +0,0 @@ -pub fn report_permission_error() { - let user = std::env::var("USER").expect( - "Unexpected error reading value of $USER!"); - let home = std::env::var("HOME").expect( - "Unexpected error reading value of $HOME!"); - let current_executable = std::env::current_exe() - .expect("Unexpected error reporting executable path!"); - eprintln!("USER: {}", user); - eprintln!("HOME: {}", home); - eprintln!("Executable: {}", current_executable.display()); - if home == "/" { - eprintln!("User {} must have permission to write to '{}silentdragonlite/' .", - user, - home); - } else { - eprintln!("User {} must have permission to write to '{}/silentdragonlite/ .", - user, - home); - } -}