mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-07-31 12:21:25 +00:00
make startup file creation fail more explicitly (#7)
* add explicit permission error handling * create error_helpers as mod to keep main.rs succint * rename error_helpers -> startup_helpers
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#[macro_use]
|
||||
extern crate rust_embed;
|
||||
|
||||
pub mod startup_helpers;
|
||||
pub mod lightclient;
|
||||
pub mod grpcconnector;
|
||||
pub mod lightwallet;
|
||||
|
20
lib/src/startup_helpers.rs
Normal file
20
lib/src/startup_helpers.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
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 '{}.zcash/' .",
|
||||
user,
|
||||
home);
|
||||
} else {
|
||||
eprintln!("User {} must have permission to write to '{}/.zcash/' .",
|
||||
user,
|
||||
home);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user