-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I have built this project and discovered that it fails no difference whether ~/.config/lefthk/config.ron
exists or not.
Error message looks like this:
ERROR lefthk: Unable to load new config due to error: No config file found.
So I looked into source code and found this:
pub fn load() -> Result<Config> {
let path = BaseDirectories::with_prefix(lefthk_core::LEFTHK_DIR_NAME)?;
fs::create_dir_all(path.get_config_home())?;
let file_name = path.place_config_file("config.ron")?;
if Path::new(&file_name).exists() {
let contents = fs::read_to_string(file_name)?;
Config::try_from(contents)?;
}
Err(LeftError::NoConfigFound)
}
This piece of code never returns Result::Ok
. So I changed it to:
pub fn load() -> Result<Config> {
let path = BaseDirectories::with_prefix(lefthk_core::LEFTHK_DIR_NAME)?;
fs::create_dir_all(path.get_config_home())?;
let file_name = path.place_config_file("config.ron")?;
if Path::new(&file_name).exists() {
let contents = fs::read_to_string(file_name)?;
return Config::try_from(contents);
}
Err(LeftError::NoConfigFound)
}
here's link to mentioned function
https://github.com/leftwm/lefthk/blob/29819976d562841b92e0447e19e945759d5f3e89/lefthk/src/config/mod.rs#L67C1-L76C2
hope it helps:)
Metadata
Metadata
Assignees
Labels
No labels