Skip to content

Commit

Permalink
Code review: renaming and restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
Hind-M committed Jan 3, 2025
1 parent 06e860b commit b967f91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libmamba/include/mamba/core/package_fetcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace mamba
struct CheckSumParams;

bool is_local_package() const;
bool use_explicit_url() const;
bool use_explicit_https_url() const;
const std::string& filename() const;
std::string channel() const;
std::string url_path() const;
Expand Down
22 changes: 9 additions & 13 deletions libmamba/src/core/package_fetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ namespace mamba
return util::starts_with(m_package_info.package_url, "file://");
}

bool PackageFetcher::use_explicit_url() const
bool PackageFetcher::use_explicit_https_url() const
{
// This excludes OCI case, which uses explicitly a "oci://" scheme,
// but is resolved later to something starting with `oci_base_url`
Expand All @@ -338,28 +338,24 @@ namespace mamba

std::string PackageFetcher::channel() const
{
if (!is_local_package() && !use_explicit_url())
{
return m_package_info.channel;
}
// Use explicit url to fetch package and leave channel empty
else
if (is_local_package() || use_explicit_https_url())
{
// Use explicit url or local package path
// to fetch package, leaving the channel empty.
return "";
}
return m_package_info.channel;
}

std::string PackageFetcher::url_path() const
{
if (!is_local_package() && !use_explicit_url())
{
return util::concat(m_package_info.platform, '/', m_package_info.filename);
}
// Use explicit url to fetch package
else
if (is_local_package() || use_explicit_https_url())
{
// Use explicit url or local package path
// to fetch package.
return m_package_info.package_url;
}
return util::concat(m_package_info.platform, '/', m_package_info.filename);
}

const std::string& PackageFetcher::url() const
Expand Down

0 comments on commit b967f91

Please sign in to comment.