Add support for flutter

Gitee close #I802EV
This commit is contained in:
Aoran Zeng 2023-09-10 21:31:16 +08:00
parent e6d9652dd2
commit ddec0a611f
2 changed files with 26 additions and 16 deletions

28
chsrc.c
View File

@ -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);
}

14
chsrc.h
View File

@ -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/"}
},