bug fix: conf extension wasn't changed to prop

This commit is contained in:
Piyush मिश्रः 2022-01-27 15:59:11 +05:30
parent e8cc6965f0
commit 307fd23b9d
3 changed files with 5 additions and 5 deletions

2
Cargo.lock generated
View File

@ -626,7 +626,7 @@ dependencies = [
[[package]] [[package]]
name = "post_maker" name = "post_maker"
version = "0.2.1" version = "0.2.2"
dependencies = [ dependencies = [
"clap", "clap",
"dirs", "dirs",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "post_maker" name = "post_maker"
version = "0.2.1" version = "0.2.2"
edition = "2021" edition = "2021"
description = "Post Maker helps you to make post for Instagram and other Social Media apps easily." description = "Post Maker helps you to make post for Instagram and other Social Media apps easily."
authors = ["PiyushXCoder <https://piyushxcoder.in>"] authors = ["PiyushXCoder <https://piyushxcoder.in>"]

View File

@ -258,16 +258,16 @@ fn load_image(
if let Some(cont) = container { if let Some(cont) = container {
let file = Path::new(&file); let file = Path::new(&file);
let conf = file.with_extension("conf"); let properties_file = file.with_extension("prop");
let read = fs::read_to_string(&conf).unwrap_or("{}".to_owned()); let read = fs::read_to_string(&properties_file).unwrap_or("{}".to_owned());
let read = match serde_json::from_str::<ImagePropertiesFile>(&read) { let read = match serde_json::from_str::<ImagePropertiesFile>(&read) {
Ok(r) => r, Ok(r) => r,
Err(e) => { Err(e) => {
warn!("Config is corrupt\n{:?}", e); warn!("Config is corrupt\n{:?}", e);
match dialog::choice_default("Config is corrupt, fix??", "yes", "no", "") { match dialog::choice_default("Config is corrupt, fix??", "yes", "no", "") {
1 => { 1 => {
if let Err(e) = fs::remove_file(&conf) { if let Err(e) = fs::remove_file(&properties_file) {
dialog::alert_default("Failed to delete image properties file!"); dialog::alert_default("Failed to delete image properties file!");
warn!("Failed to delete image properties file!\n{:?}", e); warn!("Failed to delete image properties file!\n{:?}", e);
} }