Skip to content

Commit

Permalink
[platform] move the get_root_cert_path function from unix to linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeliao committed Feb 7, 2025
1 parent 01c4e26 commit c13c77f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/platform/platform_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,14 @@ std::string multipass::platform::host_version()
return mpu::in_multipass_snap() ? multipass::platform::detail::read_os_release()
: fmt::format("{}-{}", QSysInfo::productType(), QSysInfo::productVersion());
}


std::filesystem::path mp::platform::Platform::get_root_cert_path() const
{
constexpr auto* root_cert_file_name = "multipass_root_cert.pem";

return mp::utils::in_multipass_snap()
? std::filesystem::path{mp::utils::snap_common_dir().toStdString()} / "data/multipassd/certificates" /
root_cert_file_name
: std::filesystem::path{"/usr/local/share/ca-certificates"} / root_cert_file_name;
}
10 changes: 0 additions & 10 deletions src/platform/platform_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,3 @@ long long mp::platform::Platform::get_total_ram() const
{
return static_cast<long long>(sysconf(_SC_PHYS_PAGES)) * sysconf(_SC_PAGESIZE);
}

std::filesystem::path mp::platform::Platform::get_root_cert_path() const
{
constexpr auto* root_cert_file_name = "multipass_root_cert.pem";

return mp::utils::in_multipass_snap()
? std::filesystem::path{mp::utils::snap_common_dir().toStdString()} / "data/multipassd/certificates" /
root_cert_file_name
: std::filesystem::path{"/usr/local/share/ca-certificates"} / root_cert_file_name;
}

0 comments on commit c13c77f

Please sign in to comment.