mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 23:28:30 +08:00
Yield source
This commit is contained in:
parent
419168fcf7
commit
92b3446531
|
@ -346,6 +346,27 @@ source_has_empty_url (SourceInfo *source)
|
|||
return source->url == NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户*只可能*通过下面三种方式来换源,无论哪一种都会返回一个 SourceInfo 出来
|
||||
*
|
||||
* 1. 用户指定 MirrorCode
|
||||
* 2. 用户什么都没指定 (将测速选择最快镜像)
|
||||
* 3. 用户给了一个 URL
|
||||
*
|
||||
* @dependency 变量 option
|
||||
* @dependency 变量 source
|
||||
*/
|
||||
#define chsrc_yield_source(for_what) \
|
||||
if (is_url (option)) \
|
||||
{ \
|
||||
SourceInfo __tmp = { &UserDefine, option }; \
|
||||
source = __tmp; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int __index = use_specific_mirror_or_auto_select (option, for_what); \
|
||||
source = pl_ruby_sources[__index]; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,9 @@ pl_ruby_setsrc (char *option)
|
|||
}
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_ruby);
|
||||
|
||||
/*
|
||||
if (is_url (option))
|
||||
{
|
||||
SourceInfo tmp = { &UserDefine, option };
|
||||
|
@ -62,6 +64,7 @@ pl_ruby_setsrc (char *option)
|
|||
int index = use_specific_mirror_or_auto_select (option, pl_ruby);
|
||||
source = pl_ruby_sources[index];
|
||||
}
|
||||
*/
|
||||
|
||||
chsrc_confirm_selection (&source);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user