Only append once

[GitHub #76]
This commit is contained in:
Aoran Zeng
2024-11-22 01:42:01 +08:00
parent 505b14895e
commit c1c495cf6d
10 changed files with 48 additions and 57 deletions

View File

@@ -60,16 +60,16 @@ pl_r_setsrc (char *option)
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
const char *towrite1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
const char *towrite2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")" );
const char *w1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
const char *w2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")" );
char *w = xy_2strjoin (w1, w2);
// 或者我们调用 r.exe --slave -e 上面的内容
char *config = xy_on_windows ? PL_R_Config_Windows : PL_R_Config_POSIX;
chsrc_append_to_file (towrite1, config);
chsrc_append_to_file (towrite2, config);
chsrc_log_write (config);
chsrc_append_to_file (w, config);
chsrc_conclude (&source, SetsrcType_Auto);
}