diff --git a/include/xy.h b/include/xy.h index 168472e..3c2f5ba 100644 --- a/include/xy.h +++ b/include/xy.h @@ -673,6 +673,10 @@ _xy_win_powershellv5_profile () "\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1"); } +#define xy_zshrc "~/.zshrc" +#define xy_bashrc "~/.bashrc" +#define xy_fishrc "~/.config/fish/config.fish" + /** * @note Windows上,`path` 不要夹带变量名,因为最终 access() 不会帮你转换 */ diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 5ce96c8..90a1324 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -70,8 +70,8 @@ pl_dart_flutter_setsrc (char *option) } else { - char *zshrc = "~/.zshrc"; - char *bashrc = "~/.bashrc"; + char *zshrc = xy_zshrc; + char *bashrc = xy_bashrc; chsrc_backup (zshrc); w = xy_strjoin (3, "export FLUTTER_STORAGE_BASE_URL=\"", source.url, "\"\n"); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index 2c6c92c..e82e51d 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -65,8 +65,8 @@ pl_dart_setsrc (char *option) } else { - char *zshrc = "~/.zshrc"; - char *bashrc = "~/.bashrc"; + char *zshrc = xy_zshrc; + char *bashrc = xy_bashrc; chsrc_backup (zshrc); w = xy_strjoin (3, "export PUB_HOSTED_URL=\"", source.url, "\"\n"); diff --git a/src/recipe/lang/Node.js/nvm.c b/src/recipe/lang/Node.js/nvm.c index 8bc88bd..fb05409 100644 --- a/src/recipe/lang/Node.js/nvm.c +++ b/src/recipe/lang/Node.js/nvm.c @@ -34,8 +34,8 @@ pl_nodejs_nvm_setsrc (char *option) char *w = xy_strjoin (3, "export NVM_NODEJS_ORG_MIRROR=", source.url, "\n"); - char *zshrc = "~/.zshrc"; - char *bashrc = "~/.bashrc"; + char *zshrc = xy_zshrc; + char *bashrc = xy_bashrc; chsrc_append_to_file (w, bashrc); diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index e935a52..d72c34a 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -52,21 +52,21 @@ pl_rust_rustup_setsrc (char *option) char *w = xy_2strjoin (w1, w2); - char *bashrc = "~/.bashrc"; + char *bashrc = xy_bashrc; if (xy_file_exist (bashrc)) { chsrc_backup (bashrc); chsrc_append_to_file (w, bashrc); } - char *zshrc = "~/.zshrc"; + char *zshrc = xy_zshrc; if (xy_file_exist (zshrc)) { chsrc_backup (zshrc); chsrc_append_to_file (w, zshrc); } - char *fishrc = "~/.config/fish/config.fish"; + char *fishrc = xy_fishrc; if (xy_file_exist (fishrc)) { char *w1 = xy_strjoin (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\n"); diff --git a/src/recipe/ware/Homebrew.c b/src/recipe/ware/Homebrew.c index b092398..908d421 100644 --- a/src/recipe/ware/Homebrew.c +++ b/src/recipe/ware/Homebrew.c @@ -57,18 +57,18 @@ wr_homebrew_setsrc (char *option) char *w = xy_strjoin (6, splitter, w1, w2, w3, w4, end); - char *zshrc = "~/.zshrc"; + char *zshrc = xy_zshrc; chsrc_backup (zshrc); chsrc_append_to_file (w, zshrc); - char *bashrc = "~/.bashrc"; + char *bashrc = xy_bashrc; if (xy_file_exist (bashrc)) { chsrc_backup (bashrc); chsrc_append_to_file (w, bashrc); } - char *fishrc = "~/.config/fish/config.fish"; + char *fishrc = xy_fishrc; if (xy_file_exist (fishrc)) { char *w1 = xy_strjoin(4, "set -x HOMEBREW_API_DOMAIN \"", source.url, "homebrew-bottles/api", "\"\n");