From faac0b3e9b72249a9d75c2df8bae23788850214e Mon Sep 17 00:00:00 2001 From: amtoaer Date: Wed, 3 Apr 2024 01:40:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=20up=20=E4=B8=BB=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E4=BF=9D=E5=AD=98=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/config.rs b/src/config.rs index c53e2cb..343dd96 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,6 +26,7 @@ pub struct Config { pub video_name: String, pub page_name: String, pub interval: u64, + pub upper_path: String, } impl Default for Config { @@ -37,6 +38,13 @@ impl Default for Config { video_name: "{{bvid}}".to_string(), page_name: "{{bvid}}".to_string(), interval: 1200, + upper_path: dirs::config_dir() + .unwrap() + .join("bili-sync") + .join("upper_face") + .to_str() + .unwrap() + .to_string(), } } } @@ -54,6 +62,10 @@ impl Config { for path in self.favorite_list.values() { assert!(Path::new(path).is_absolute(), "Path in favorite list must be absolute"); } + assert!( + Path::new(&self.upper_path).is_absolute(), + "Upper face path must be absolute" + ); assert!(!self.video_name.is_empty(), "No video name template found"); assert!(!self.page_name.is_empty(), "No page name template found"); match self.credential {