mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-25 11:59:54 +08:00
@@ -3,8 +3,9 @@
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||
* |
|
||||
* Created On : <2024-10-02>
|
||||
* Last Modified : <2024-10-02>
|
||||
* Last Modified : <2024-11-22>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -48,37 +49,37 @@ pl_rust_rustup_setsrc (char *option)
|
||||
|
||||
chsrc_yield_source_and_confirm (pl_rust_rustup);
|
||||
|
||||
char *dist_server = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"");
|
||||
char *update_root = xy_strjoin (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"");
|
||||
char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n");
|
||||
char *w2 = xy_strjoin (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"\n");
|
||||
|
||||
char *w = xy_2strjoin (w1, w2)
|
||||
|
||||
char *bashrc = "~/.bashrc";
|
||||
if (xy_file_exist (bashrc))
|
||||
{
|
||||
chsrc_backup (bashrc);
|
||||
chsrc_append_to_file (dist_server, bashrc);
|
||||
chsrc_append_to_file (update_root, bashrc);
|
||||
chsrc_append_to_file (w, bashrc);
|
||||
}
|
||||
|
||||
char *zshrc = "~/.zshrc";
|
||||
if (xy_file_exist (zshrc))
|
||||
{
|
||||
chsrc_backup (zshrc);
|
||||
chsrc_append_to_file (dist_server, zshrc);
|
||||
chsrc_append_to_file (update_root, zshrc);
|
||||
chsrc_append_to_file (w, zshrc);
|
||||
}
|
||||
|
||||
char *fishrc = "~/.config/fish/config.fish";
|
||||
if (xy_file_exist (fishrc))
|
||||
{
|
||||
char *dist_server = xy_2strjoin ("set -x RUSTUP_DIST_SERVER ", source.url);
|
||||
char *update_root = xy_2strjoin ("set -x RUSTUP_UPDATE_ROOT ", xy_2strjoin (source.url, "/rustup"));
|
||||
char *w1 = xy_strjoin (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\n");
|
||||
char *w2 = xy_strjoin (3, "set -x RUSTUP_UPDATE_ROOT ", source.url, "/rustup\n");
|
||||
|
||||
char *w = xy_2strjoin (w1, w2)
|
||||
|
||||
chsrc_backup (fishrc);
|
||||
chsrc_append_to_file (dist_server, fishrc);
|
||||
chsrc_append_to_file (update_root, fishrc);
|
||||
chsrc_append_to_file (w, fishrc);
|
||||
}
|
||||
|
||||
|
||||
chsrc_conclude (&source, setsrc_type);
|
||||
chsrc_note2 ("请您重启终端使rustup环境变量生效");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user