@@ -11,11 +11,11 @@ pl_rust_cargo_prelude (void)
1111
1212 chef_set_recipe_created_on (this , "2023-08-30" );
1313 chef_set_recipe_last_updated (this , "2025-12-31" );
14- chef_set_sources_last_updated (this , "2026-01 -21" );
14+ chef_set_sources_last_updated (this , "2026-03 -21" );
1515
1616 chef_set_chef (this , NULL );
1717 chef_set_cooks (this , 2 , "@Mikachu2333" , "@ccmywish" );
18- chef_set_sauciers (this , 1 , "@happy-game" );
18+ chef_set_sauciers (this , 2 , "@happy-game" , "@AnonTokio " );
1919
2020 chef_set_scope_cap (this , ProjectScope , ScopeCap_Able_But_Not_Implemented );
2121 chef_set_scope_cap (this , UserScope , ScopeCap_Able_And_Implemented );
@@ -78,12 +78,29 @@ pl_rust_cargo_note_get_src_mirror (char *url, bool sparse)
7878 say (xy_2strcat (url , sparse ? " (sparse)" : "" ));
7979}
8080
81+ static char *
82+ pl_rust_cargo_config_file (void )
83+ {
84+ char * file = NULL ;
85+ char * cargo_home = getenv ("CARGO_HOME" );
86+ if (cargo_home && * cargo_home )
87+ {
88+ file = xy_path_join (cargo_home , "config.toml" );
89+ }
90+ else
91+ {
92+ file = xy_normalize_path ("~/.cargo/config.toml" );
93+ }
94+ return file ;
95+ }
96+
8197void
8298pl_rust_cargo_getsrc (char * option )
8399{
84- char * cargo_config_file = xy_normalize_path ( "~/.cargo/config.toml" );
100+ char * cargo_config_file = pl_rust_cargo_config_file ( );
85101
86102 char * raw_content = xy_file_read (cargo_config_file );
103+ free (cargo_config_file );
87104 char * formatted_content = xy_str_gsub (raw_content , " " , "" );
88105 formatted_content = xy_str_gsub (formatted_content , "'" , "\"" );
89106
@@ -136,12 +153,7 @@ pl_rust_cargo_setsrc (char *option)
136153 chsrc_use_this_source (pl_rust_cargo );
137154
138155 char * default_content = RAWSTR_pl_rust_cargo_config ;
139- char * cargo_config_dir = "~/.cargo/" ;
140- char * cargo_config_file = xy_2strcat (cargo_config_dir , "config.toml" );
141-
142- chsrc_ensure_dir (cargo_config_dir );
143-
144- cargo_config_file = xy_normalize_path (cargo_config_file );
156+ char * cargo_config_file = pl_rust_cargo_config_file ();
145157
146158 if (xy_file_exist (cargo_config_file ))
147159 {
@@ -188,6 +200,7 @@ pl_rust_cargo_setsrc (char *option)
188200 goto finish ;
189201
190202finish :
203+ free (cargo_config_file );
191204 chsrc_determine_chgtype (ChgType_Auto );
192205 chsrc_conclude (& source );
193206}
0 commit comments