Move curl testing into auto_select_

This commit is contained in:
Aoran Zeng 2024-06-13 00:17:01 +08:00
parent 0fd6d13755
commit 4896a4c4c3
2 changed files with 10 additions and 9 deletions

View File

@ -5,7 +5,7 @@
* Authors : Aoran Zeng <ccmywish@qq.com>
* | Heng Guo <2085471348@qq.com>
* Created on : <2023-08-29>
* Last modified : <2024-06-11>
* Last modified : <2024-06-13>
*
* chsrc
* ------------------------------------------------------------*/
@ -257,6 +257,14 @@ auto_select_ (SourceInfo *sources, size_t size, const char *target)
bool onlyone = false;
if (2==size) onlyone = true;
char *check_curl = xy_str_to_quietcmd ("curl --version");
bool exist_curl = query_program_exist (check_curl, "curl");
if (!exist_curl)
{
chsrc_error ("没有curl命令,无法测速");
exit (1);
}
double speeds[size];
double speed = 0.0;
for (int i=0;i<size;i++)

View File

@ -10,7 +10,7 @@
* chsrc: Change Source
* ------------------------------------------------------------*/
#define Chsrc_Version "v0.1.7.pre-2024/06/12"
#define Chsrc_Version "v0.1.7.pre-2024/06/13"
#define Chsrc_Maintain_URL "https://gitee.com/RubyMetric/chsrc"
#include "chsrc.h"
@ -2654,13 +2654,6 @@ get_target (const char *input, TargetOp code, char *option)
}
else if (TargetOp_Cesu_Source==code)
{
char* check_cmd = xy_str_to_quietcmd ("curl --version");
bool exist_b = query_program_exist (check_cmd, "curl");
if (!exist_b)
{
chsrc_error ("没有curl命令,无法测速");
exit (1);
}
auto_select_ (target->sources, target->sources_n, input-3);
return true;
}