Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more condarc paths #3695

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions libmamba/src/api/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,25 @@ namespace mamba
fs::u8path(util::user_home_dir()) / ".conda/condarc.d",
fs::u8path(util::user_home_dir()) / ".condarc",
};

std::array<std::string, 3> condarc_list = {"/.condarc", "/condarc", "/condarc.d"};
if (util::get_env("XDG_CONFIG_HOME"))
{
const std::string xgd_config_home = util::get_env("XDG_CONFIG_HOME").value();
for (const auto& path: condarc_list)
{
conda_user.push_back(fs::u8path(xgd_config_home) + "/conda" + path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can rely on the concatenation operator of the path (ie operator/) instead of that of strings:

conda_user.push_back(fs::u8path(xgd_config_home) / "conda" / path);

This requires to remove the heading / in the member of the condarc_list above.

}
}
if (util::get_env("CONDA_PREFIX"))
{
const std::string conda_prefix = util::get_env("CONDA_PREFIX").value();
for (const auto& path: condarc_list)
{
conda_user.push_back(fs::u8path(conda_prefix) + path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark here.

}
}

if (util::get_env("CONDARC"))
{
conda_user.push_back(fs::u8path(util::get_env("CONDARC").value()));
Expand Down
Loading