Skip to content

Commit 3b7b065

Browse files
committed
refactor to fix build on win
1 parent a1a8439 commit 3b7b065

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libmamba/src/core/shell_init.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = (shell == "zsh") ? util::zsh_home_dir() : util::user_home_dir();
1262+
fs::u8path home = 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,6 +1275,7 @@ namespace mamba
12751275
}
12761276
else if (shell == "zsh")
12771277
{
1278+
home = zsh_home_dir();
12781279
fs::u8path zshrc_path = home / ".zshrc";
12791280
modify_rc_file(context, zshrc_path, conda_prefix, shell, mamba_exe);
12801281
}
@@ -1340,7 +1341,7 @@ namespace mamba
13401341
void deinit_shell(Context& context, const std::string& shell, const fs::u8path& conda_prefix)
13411342
{
13421343
auto mamba_exe = get_self_exe_path();
1343-
fs::u8path home = (shell == "zsh") ? util::zsh_home_dir() : util::user_home_dir();
1344+
fs::u8path home = util::user_home_dir();
13441345
if (shell == "bash")
13451346
{
13461347
fs::u8path bashrc_path = (util::on_mac || util::on_win) ? home / ".bash_profile"
@@ -1349,6 +1350,7 @@ namespace mamba
13491350
}
13501351
else if (shell == "zsh")
13511352
{
1353+
home = zsh_home_dir();
13521354
fs::u8path zshrc_path = home / ".zshrc";
13531355
reset_rc_file(context, zshrc_path, shell, mamba_exe);
13541356
}
@@ -1407,14 +1409,15 @@ namespace mamba
14071409

14081410
fs::u8path config_path_for_shell(const std::string& shell)
14091411
{
1410-
fs::u8path home = (shell == "zsh") ? util::zsh_home_dir() : util::user_home_dir();
1412+
fs::u8path home = util::user_home_dir();
14111413
fs::u8path config_path;
14121414
if (shell == "bash")
14131415
{
14141416
config_path = (util::on_mac || util::on_win) ? home / ".bash_profile" : home / ".bashrc";
14151417
}
14161418
else if (shell == "zsh")
14171419
{
1420+
home = zsh_home_dir();
14181421
config_path = home / ".zshrc";
14191422
}
14201423
else if (shell == "xonsh")

0 commit comments

Comments
 (0)