@@ -10,12 +10,12 @@ pl_rust_cargo_prelude (void)
1010 chef_prep_this (pl_rust_cargo , gsr );
1111
1212 chef_set_created_on (this , "2023-08-30" );
13- chef_set_last_updated (this , "2025-09-13 " );
13+ chef_set_last_updated (this , "2025-09-18 " );
1414 chef_set_sources_last_updated (this , "2025-06-18" );
1515
1616 chef_set_chef (this , NULL );
17- chef_set_cooks (this , 1 , "@ccmywish" );
18- chef_set_sauciers (this , 2 , "@Mikachu2333" , "@happy-game " );
17+ chef_set_cooks (this , 2 , "@happy-game" , "@ccmywish" );
18+ chef_set_sauciers (this , 1 , "@Mikachu2333" );
1919
2020 chef_allow_local_mode (this , PartiallyCan , "可以基于本项目换源吗?请帮助确认" , "Can it change sources based on this project? Please help confirm" );
2121 chef_forbid_english (this );
@@ -56,9 +56,9 @@ pl_rust_cargo_getsrc (char *option)
5656 if (xy_file_exist (cargo_config_file ))
5757 {
5858 // 尝试提取 [source.mirror] 下的 registry URL
59- char * grep_cmd = xy_str_gsub ("grep -A1 '\\[source\\.mirror\\]' '@f@' | grep 'registry' | cut -d'\"' -f2 " , "@f@" , cargo_config_file );
59+ char * grep_cmd = xy_str_gsub ("grep -A1 '\\[source\\.mirror\\]' '@f@' | grep 'registry' | sed 's/[^\"]*\"\\([^\"]*\\)\".*/\\1/' " , "@f@" , cargo_config_file );
6060 chsrc_ensure_program ("grep" );
61- chsrc_ensure_program ("cut " );
61+ chsrc_ensure_program ("sed " );
6262
6363 char * mirror_url ;
6464 int status = xy_run_get_stdout (grep_cmd , & mirror_url );
@@ -131,12 +131,16 @@ pl_rust_cargo_setsrc (char *option)
131131
132132 if (0 == status )
133133 {
134- #if defined(XY_Build_On_macOS ) || defined(XY_Build_On_BSD )
135- char * sed_cmd = "sed -i '' " ;
136- #else
137- char * sed_cmd = "sed -i " ;
138- #endif
139-
134+ char * sed_cmd ;
135+ if (xy .on_bsd || xy .on_macos )
136+ {
137+ sed_cmd = "sed -i '' " ;
138+ }
139+ else
140+ {
141+ sed_cmd = "sed -i " ;
142+ }
143+
140144 char * update_cmd = xy_str_gsub (RAWSTR_pl_rust_cargo_update_replace_with , "@sed@" , sed_cmd );
141145 update_cmd = xy_str_gsub (update_cmd , "@f@" , cargo_config_file );
142146 chsrc_run (update_cmd , RunOpt_Default );
0 commit comments