@@ -44,27 +44,29 @@ pub fn chain_advice(config: &Mapping) -> ProcessOutput {
4444 use nix:: unistd:: { Gid , Group as NixGroup , Uid , User } ;
4545 use std:: os:: unix:: fs:: MetadataExt ;
4646 if !service_state. is_connected ( ) {
47- let core = {
47+ let core: nyanpasu_utils :: core :: CoreType = {
4848 crate :: config:: Config :: verge ( )
4949 . latest ( )
5050 . clash_core
5151 . as_ref ( )
5252 . unwrap_or ( & crate :: config:: nyanpasu:: ClashCore :: default ( ) )
53+ . clone ( )
54+ . into ( )
5355 } ;
5456 let core_path = crate :: core:: clash:: core:: find_binary_path ( & core) ;
55- if let Some ( core_path) = core_path {
57+ if let Ok ( core_path) = core_path {
5658 if let Some ( metadata) = std:: fs:: metadata ( & core_path) . ok ( ) {
5759 let uid = metadata. uid ( ) ;
5860 let gid = metadata. gid ( ) ;
5961 let user = User :: from_uid ( Uid :: from_raw ( uid) ) . ok ( ) . flatten ( ) ;
6062 let group = NixGroup :: from_gid ( Gid :: from_raw ( gid) ) . ok ( ) . flatten ( ) ;
6163 if let ( Some ( user) , Some ( group) ) = ( user, group) {
6264 if !* crate :: consts:: IS_APPIMAGE
63- && ( user. name ( ) != "root" || group. name ( ) != ROOT_GROUP )
65+ && ( user. name != "root" || group. name != ROOT_GROUP )
6466 {
6567 tracing:: warn!( "The core file is not granted the necessary permissions, grant it" ) ;
6668 let msg = t ! ( "dialog.info.grant_core_permission" ) ;
67- if crate :: utils:: dialog:: ask_dialog ( & msg) {
69+ if crate :: utils:: dialog:: ask_dialog ( msg. as_ref ( ) ) {
6870 if let Err ( err) = crate :: core:: manager:: grant_permission ( & core)
6971 {
7072 tracing:: error!(
0 commit comments