mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
👷 gucc: use std ranges from C++23 in fstab
This commit is contained in:
parent
66985fc5f8
commit
dc107950b4
@ -4,31 +4,15 @@
|
|||||||
|
|
||||||
#include <cctype> // for tolower
|
#include <cctype> // for tolower
|
||||||
|
|
||||||
#include <algorithm> // for transform
|
#include <algorithm> // for transform
|
||||||
#include <filesystem>
|
#include <filesystem> // for fs::path
|
||||||
|
#include <ranges> // for ranges::transform
|
||||||
|
|
||||||
#include <fmt/compile.h>
|
#include <fmt/compile.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
|
||||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <range/v3/algorithm/transform.hpp>
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
using namespace std::string_view_literals;
|
using namespace std::string_view_literals;
|
||||||
|
|
||||||
@ -68,7 +52,7 @@ constexpr auto get_mount_options(std::string_view mount_opts, std::string_view b
|
|||||||
|
|
||||||
constexpr auto string_tolower(std::string_view text) noexcept -> std::string {
|
constexpr auto string_tolower(std::string_view text) noexcept -> std::string {
|
||||||
std::string res{text};
|
std::string res{text};
|
||||||
ranges::transform(res, res.begin(),
|
std::ranges::transform(res, res.begin(),
|
||||||
[](char char_elem) { return static_cast<char>(std::tolower(static_cast<unsigned char>(char_elem))); });
|
[](char char_elem) { return static_cast<char>(std::tolower(static_cast<unsigned char>(char_elem))); });
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -83,7 +67,7 @@ constexpr auto get_converted_fs(std::string_view fstype) noexcept -> std::string
|
|||||||
namespace gucc::fs {
|
namespace gucc::fs {
|
||||||
|
|
||||||
auto gen_fstab_entry(const Partition& partition) noexcept -> std::optional<std::string> {
|
auto gen_fstab_entry(const Partition& partition) noexcept -> std::optional<std::string> {
|
||||||
// Apperently some FS names named differently in /etc/fstab.
|
// Apparently some FS names named differently in /etc/fstab.
|
||||||
const auto& fstype = get_converted_fs(partition.fstype);
|
const auto& fstype = get_converted_fs(partition.fstype);
|
||||||
|
|
||||||
const auto& luks_mapper_name = partition.luks_mapper_name;
|
const auto& luks_mapper_name = partition.luks_mapper_name;
|
||||||
|
Loading…
Reference in New Issue
Block a user