diff --git a/chsrc.c b/chsrc.c index eb54746..6c44674 100644 --- a/chsrc.c +++ b/chsrc.c @@ -792,26 +792,30 @@ pl_dart_setsrc (char* option) char* cmd = NULL; + char* pub = xy_2strjoin(source.url, "dart-pub"); + char* flutter = xy_2strjoin(source.url, "flutter"); + if (xy_on_windows) { - if (xy_file_exist(xy_win_powershell_profile)) { - chsrc_runcmd( - xy_strjoin(4, "echo $env:PUB_HOSTED_URL = \"", source.url, "\" >> ", xy_win_powershell_profile)); + if (xy_file_exist(xy_win_powershell_profile)) + { + chsrc_runcmd(xy_strjoin(4, "echo $env:PUB_HOSTED_URL = \"", pub, "\" >> ", xy_win_powershell_profile)); + chsrc_runcmd(xy_strjoin(4, "echo $env:FLUTTER_STORAGE_BASE_URL = \"", flutter, "\" >> ", xy_win_powershell_profile)); } - if (xy_file_exist(xy_win_powershellv5_profile)) { - chsrc_runcmd( - xy_strjoin(4, "echo $env:PUB_HOSTED_URL = \"", source.url, "\" >> ", xy_win_powershellv5_profile)); + + if (xy_file_exist(xy_win_powershellv5_profile)) + { + chsrc_runcmd(xy_strjoin(4, "echo $env:PUB_HOSTED_URL = \"", pub, "\" >> ", xy_win_powershellv5_profile)); + chsrc_runcmd(xy_strjoin(4, "echo $env:FLUTTER_STORAGE_BASE_URL = \"", flutter, "\" >> ", xy_win_powershell_profile)); } } + else { - cmd = "echo 'export PUB_HOSTED_URL=\"", source.url, "\"' >> ~/.bashrc"; + cmd = "echo 'export PUB_HOSTED_URL=\"", pub, "\"' >> ~/.bashrc >> ~/.zshrc"; + chsrc_runcmd(cmd); + cmd = "export 'FLUTTER_STORAGE_BASE_URL=\"", flutter, "\"' >> ~/.bashrc >> ~/.zshrc"; chsrc_runcmd(cmd); - - if (xy_file_exist("~/.zshrc")) { - cmd = "echo 'export PUB_HOSTED_URL=\"", source.url, "\"' >> ~/.zshrc"; - chsrc_runcmd(cmd); - } } chsrc_say_thanks(&source); } diff --git a/chsrc.h b/chsrc.h index 4dbbf7f..f1067c7 100644 --- a/chsrc.h +++ b/chsrc.h @@ -272,12 +272,18 @@ pl_dotnet_sources[] = { /** * 2023-09-10 更新 + * + * @note 我们这里挑选的必须也支持 Flutter + * + * 我们将会在setsrc函数中生成 + * 1. https://mirrors.tuna.tsinghua.edu.cn/dart-pub + * 2. https://mirrors.tuna.tsinghua.edu.cn/flutter */ pl_dart_sources[] = { - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub"}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub"}, - {&Tencent, "https://mirrors.cloud.tencent.com/dart-pub/"}, - {&Nju, "https://mirror.nju.edu.cn/dart-pub"}, + // {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/"}, // 不确定SJTUG的flutter镜像给的对不对 + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/"}, + {&Tencent, "https://mirrors.cloud.tencent.com/"}, + {&Nju, "https://mirror.nju.edu.cn/"} },