Improve error messages for non-existant config dir
This commit is contained in:
parent
f544d0e19a
commit
30305cd506
1 changed files with 10 additions and 2 deletions
12
src/main.rs
12
src/main.rs
|
@ -40,8 +40,11 @@ fn main() {
|
||||||
pretty_env_logger::formatted_builder().filter(Some("eww"), log_level_filter).init();
|
pretty_env_logger::formatted_builder().filter(Some("eww"), log_level_filter).init();
|
||||||
|
|
||||||
let result: Result<_> = try {
|
let result: Result<_> = try {
|
||||||
let paths =
|
let paths = opts
|
||||||
opts.config_path.map(EwwPaths::from_config_dir).unwrap_or_else(EwwPaths::default).context("Failed set paths")?;
|
.config_path
|
||||||
|
.map(EwwPaths::from_config_dir)
|
||||||
|
.unwrap_or_else(EwwPaths::default)
|
||||||
|
.context("Failed to initialize eww paths")?;
|
||||||
|
|
||||||
match opts.action {
|
match opts.action {
|
||||||
opts::Action::ClientOnly(action) => {
|
opts::Action::ClientOnly(action) => {
|
||||||
|
@ -114,6 +117,11 @@ impl EwwPaths {
|
||||||
} else {
|
} else {
|
||||||
config_dir
|
config_dir
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !config_dir.exists() {
|
||||||
|
bail!("Configuration directory {} does not exist", config_dir.display());
|
||||||
|
}
|
||||||
|
|
||||||
let config_dir = config_dir.canonicalize()?;
|
let config_dir = config_dir.canonicalize()?;
|
||||||
let daemon_id = base64::encode(format!("{}", config_dir.display()));
|
let daemon_id = base64::encode(format!("{}", config_dir.display()));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue