@@ -14,10 +14,10 @@ pl_rust_cargo_prelude (void)
1414 chef_set_sources_last_updated (this , "2025-06-18" );
1515
1616 chef_set_chef (this , NULL );
17- chef_set_cooks (this , 2 , "@ccmywish " , "@Mikachu2333 " );
17+ chef_set_cooks (this , 2 , "@Mikachu2333 " , "@ccmywish " );
1818 chef_set_sauciers (this , 1 , "@happy-game" );
1919
20- chef_allow_local_mode (this , PartiallyCan , "可以基于本项目换源吗?请帮助确认" , "Can it change sources based on this project? Please help confirm" );
20+ chef_allow_local_mode (this , FullyCan , NULL , NULL );
2121 chef_forbid_english (this );
2222 chef_allow_user_define (this );
2323
@@ -72,15 +72,15 @@ pl_rust_cargo_getsrc (char *option)
7272{
7373 char * cargo_config_file = xy_normalize_path ("~/.cargo/config.toml" );
7474
75- char * raw_content = xy_file_to_str (cargo_config_file );
75+ char * raw_content = xy_file_read (cargo_config_file );
7676 char * formatted_content = xy_str_gsub (raw_content , " " , "" );
7777 formatted_content = xy_str_gsub (formatted_content , "'" , "\"" );
7878 free (raw_content );
7979
8080 XyStrFindResult_t result_has_mirror = xy_str_find (formatted_content , "replace-with" );
8181 if (result_has_mirror .found )
8282 {
83- char * mirror_name = xy_str_take_until_newline (formatted_content + result_has_mirror .end + 1 );
83+ char * mirror_name = xy_str_next_nonempty_line (formatted_content + result_has_mirror .end + 1 );
8484 mirror_name = xy_str_delete_prefix (mirror_name , "=\"" );
8585 mirror_name = xy_str_delete_suffix (mirror_name , "\"" );
8686
@@ -90,7 +90,7 @@ pl_rust_cargo_getsrc (char *option)
9090 pl_rust_cargo_note_get_src_default ();
9191 return ;
9292 }
93- char * mirror_url = xy_str_take_until_newline (formatted_content + result_mirror .end + 1 );
93+ char * mirror_url = xy_str_next_nonempty_line (formatted_content + result_mirror .end + 1 );
9494 mirror_url = xy_str_delete_prefix (mirror_url , "registry=\"" );
9595 mirror_url = xy_str_delete_suffix (mirror_url , "\"" );
9696 if (xy_str_find (mirror_url , "sparse+" ).found )
@@ -138,7 +138,7 @@ pl_rust_cargo_setsrc (char *option)
138138 {
139139 chsrc_backup (cargo_config_file );
140140
141- char * raw_content = xy_file_to_str (cargo_config_file );
141+ char * raw_content = xy_file_read (cargo_config_file );
142142
143143 XyStrFindResult_t result_has_mirror = xy_str_find (raw_content , "replace-with" );
144144 if (!result_has_mirror .found )
@@ -147,7 +147,7 @@ pl_rust_cargo_setsrc (char *option)
147147 goto finish ;
148148 }
149149
150- char * mirror_name = xy_str_take_until_newline (raw_content + result_has_mirror .end + 1 );
150+ char * mirror_name = xy_str_next_nonempty_line (raw_content + result_has_mirror .end + 1 );
151151 mirror_name = xy_str_gsub (mirror_name , " " , "" );
152152 mirror_name = xy_str_gsub (mirror_name , "'" , "\"" );
153153 mirror_name = xy_str_delete_prefix (mirror_name , "=\"" );
@@ -160,7 +160,7 @@ pl_rust_cargo_setsrc (char *option)
160160 goto finish ;
161161 }
162162
163- char * mirror_url = xy_str_take_until_newline (raw_content + result_mirror .end + 1 );
163+ char * mirror_url = xy_str_next_nonempty_line (raw_content + result_mirror .end + 1 );
164164 mirror_url = xy_str_gsub (mirror_url , " " , "" );
165165 if (!xy_str_find (mirror_url , "registry" ).found )
166166 {
0 commit comments