mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-10 04:44:07 +08:00
Move curl testing into auto_select_
This commit is contained in:
parent
0fd6d13755
commit
4896a4c4c3
@ -5,7 +5,7 @@
|
|||||||
* Authors : Aoran Zeng <ccmywish@qq.com>
|
* Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* | Heng Guo <2085471348@qq.com>
|
* | Heng Guo <2085471348@qq.com>
|
||||||
* Created on : <2023-08-29>
|
* Created on : <2023-08-29>
|
||||||
* Last modified : <2024-06-11>
|
* Last modified : <2024-06-13>
|
||||||
*
|
*
|
||||||
* chsrc 头文件
|
* chsrc 头文件
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
@ -257,6 +257,14 @@ auto_select_ (SourceInfo *sources, size_t size, const char *target)
|
|||||||
bool onlyone = false;
|
bool onlyone = false;
|
||||||
if (2==size) onlyone = true;
|
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 speeds[size];
|
||||||
double speed = 0.0;
|
double speed = 0.0;
|
||||||
for (int i=0;i<size;i++)
|
for (int i=0;i<size;i++)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* chsrc: Change Source —— 全平台通用命令行换源工具
|
* 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"
|
#define Chsrc_Maintain_URL "https://gitee.com/RubyMetric/chsrc"
|
||||||
|
|
||||||
#include "chsrc.h"
|
#include "chsrc.h"
|
||||||
@ -2654,13 +2654,6 @@ get_target (const char *input, TargetOp code, char *option)
|
|||||||
}
|
}
|
||||||
else if (TargetOp_Cesu_Source==code)
|
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);
|
auto_select_ (target->sources, target->sources_n, input-3);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user