@@ -1259,7 +1259,7 @@ namespace mamba
12591259 {
12601260 init_root_prefix (context, shell, conda_prefix);
12611261 auto mamba_exe = get_self_exe_path ();
1262- fs::u8path home = util::user_home_dir ();
1262+ fs::u8path home = (shell == " zsh " ) ? util::zsh_home_dir () : util::user_home_dir ();
12631263 if (shell == " bash" )
12641264 {
12651265 // On Linux, when opening the terminal, .bashrc is sourced (because it is an interactive
@@ -1275,15 +1275,7 @@ namespace mamba
12751275 }
12761276 else if (shell == " zsh" )
12771277 {
1278- fs::u8path zshrc_path
1279- // use ZDOTDIR if set and fallback to HOME
1280- const char * zdotdir = std::getenv (" ZDOTDIR" );
1281- if (zdotdir != nullptr && zdotdir[0 ] != ' \0 ' )
1282- {
1283- zshrc_path = fs::u8path (zdotdir) / " .zshrc" ;
1284- } else {
1285- zshrc_path = home / " .zshrc" ;
1286- }
1278+ fs::u8path zshrc_path = home / " .zshrc" ;
12871279 modify_rc_file (context, zshrc_path, conda_prefix, shell, mamba_exe);
12881280 }
12891281 else if (shell == " csh" )
@@ -1348,7 +1340,7 @@ namespace mamba
13481340 void deinit_shell (Context& context, const std::string& shell, const fs::u8path& conda_prefix)
13491341 {
13501342 auto mamba_exe = get_self_exe_path ();
1351- fs::u8path home = util::user_home_dir ();
1343+ fs::u8path home = (shell == " zsh " ) ? util::zsh_home_dir () : util::user_home_dir ();
13521344 if (shell == " bash" )
13531345 {
13541346 fs::u8path bashrc_path = (util::on_mac || util::on_win) ? home / " .bash_profile"
@@ -1357,15 +1349,7 @@ namespace mamba
13571349 }
13581350 else if (shell == " zsh" )
13591351 {
1360- fs::u8path zshrc_path
1361- // use ZDOTDIR if set and fallback to HOME
1362- const char * zdotdir = std::getenv (" ZDOTDIR" );
1363- if (zdotdir != nullptr && zdotdir[0 ] != ' \0 ' )
1364- {
1365- zshrc_path = fs::u8path (zdotdir) / " .zshrc" ;
1366- } else {
1367- zshrc_path = home / " .zshrc" ;
1368- }
1352+ fs::u8path zshrc_path = home / " .zshrc" ;
13691353 reset_rc_file (context, zshrc_path, shell, mamba_exe);
13701354 }
13711355 else if (shell == " xonsh" )
@@ -1423,22 +1407,15 @@ namespace mamba
14231407
14241408 fs::u8path config_path_for_shell (const std::string& shell)
14251409 {
1426- fs::u8path home = util::user_home_dir ();
1410+ fs::u8path home = (shell == " zsh " ) ? util::zsh_home_dir () : util::user_home_dir ();
14271411 fs::u8path config_path;
14281412 if (shell == " bash" )
14291413 {
14301414 config_path = (util::on_mac || util::on_win) ? home / " .bash_profile" : home / " .bashrc" ;
14311415 }
14321416 else if (shell == " zsh" )
14331417 {
1434- // use ZDOTDIR if set and fallback to HOME
1435- const char * zdotdir = std::getenv (" ZDOTDIR" );
1436- if (zdotdir != nullptr && zdotdir[0 ] != ' \0 ' )
1437- {
1438- config_path = fs::u8path (zdotdir) / " .zshrc" ;
1439- } else {
1440- config_path = home / " .zshrc" ;
1441- }
1418+ config_path = home / " .zshrc" ;
14421419 }
14431420 else if (shell == " xonsh" )
14441421 {
0 commit comments