11/** ------------------------------------------------------------
22 * SPDX-License-Identifier: GPL-3.0-or-later
33 * -------------------------------------------------------------
4- * File Authors : Aoran Zeng <[email protected] > 5- * Contributors : Yangmoooo <[email protected] > 6- * | Mikachu2333 <[email protected] > 4+ * File Authors : Aoran Zeng <[email protected] > 5+ * Contributors : Yangmoooo <[email protected] > 6+ * | Mikachu2333 <[email protected] > 77 * |
88 * Created On : <2024-10-02>
99 * Last Modified : <2025-06-19>
@@ -19,16 +19,16 @@ static SourceProvider_t pl_rust_binary_upstream =
1919 * @update 2025-06-17
2020 */
2121static Source_t pl_rust_rustup_sources [] = {
22- {& pl_rust_binary_upstream , "https://static.rust-lang.org" },
23- {& MirrorZ , "https://mirrors.cernet.edu.cn/rustup" },
24- {& Tuna , "https://mirrors.tuna.tsinghua.edu.cn/rustup" },
25- {& Ustc , "https://mirrors.ustc.edu.cn/rust-static" },
26- {& Nju , "https://mirror.nju.edu.cn/rustup" },
27- {& Sjtug_Zhiyuan , "https://mirror.sjtu.edu.cn/rust-static" },
28- {& Zju , "https://mirrors.zju.edu.cn/rustup" },
29- {& Iscas , "https://mirror.iscas.ac.cn/rustup" },
30- {& Ali , "https://mirrors.aliyun.com/rustup" },
31- {& RsProxyCN , "https://rsproxy.cn" }};
22+ {& pl_rust_binary_upstream , "https://static.rust-lang.org" },
23+ {& MirrorZ , "https://mirrors.cernet.edu.cn/rustup" },
24+ {& Tuna , "https://mirrors.tuna.tsinghua.edu.cn/rustup" },
25+ {& Ustc , "https://mirrors.ustc.edu.cn/rust-static" },
26+ {& Nju , "https://mirror.nju.edu.cn/rustup" },
27+ {& Sjtug_Zhiyuan , "https://mirror.sjtu.edu.cn/rust-static" },
28+ {& Zju , "https://mirrors.zju.edu.cn/rustup" },
29+ {& Iscas , "https://mirror.iscas.ac.cn/rustup" },
30+ {& Ali , "https://mirrors.aliyun.com/rustup" },
31+ {& RsProxyCN , "https://rsproxy.cn" }};
3232def_sources_n (pl_rust_rustup );
3333
3434
@@ -52,6 +52,16 @@ pl_rust_rustup_setsrc (char *option)
5252{
5353 chsrc_yield_source_and_confirm (pl_rust_rustup );
5454
55+ #ifdef XY_On_Windows
56+
57+ char * cmd1 = xy_strjoin (3 , "setx RUSTUP_DIST_SERVER \"" , source .url , "\"" );
58+ char * cmd2 = xy_strjoin (3 , "setx RUSTUP_UPDATE_ROOT \"" , source .url , "/rustup\"" );
59+
60+ char * cmd = xy_strjoin (3 , cmd1 , " & " , cmd2 );
61+ chsrc_run (cmd , RunOpt_Dont_Notify_On_Success |RunOpt_No_Last_New_Line );
62+
63+ #else
64+
5565 char * w1 = xy_strjoin (3 , "export RUSTUP_DIST_SERVER=\"" , source .url , "\"\n" );
5666 char * w2 = xy_strjoin (3 , "export RUSTUP_UPDATE_ROOT=\"" , source .url , "/rustup\"\n" );
5767
@@ -82,6 +92,7 @@ pl_rust_rustup_setsrc (char *option)
8292 chsrc_backup (fishrc );
8393 chsrc_append_to_file (w , fishrc );
8494 }
95+ #endif
8596
8697 chsrc_determine_chgtype (ChgType_Auto );
8798 chsrc_conclude (& source );
0 commit comments