From 23e95bd0e5e088aaa8dde1c66c7c4e672f6ec71a Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Fri, 15 Dec 2023 00:23:46 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20drivers:=20use=20literals=20wher?= =?UTF-8?q?e=20possible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drivers.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/drivers.cpp b/src/drivers.cpp index 7d9883e..05b70b5 100644 --- a/src/drivers.cpp +++ b/src/drivers.cpp @@ -15,6 +15,7 @@ #include using namespace ftxui; +using namespace std::string_view_literals; #ifdef NDEVENV #include "follow_process_log.hpp" @@ -34,7 +35,7 @@ static void install_ati() noexcept { #ifdef NDEVENV static void install_all_drivers() noexcept { - static constexpr auto packages = "xf86-input-libinput xf86-video-fbdev xf86-video-vesa xf86-video-amdgpu xf86-video-ati xf86-video-intel xf86-video-nouveau"; + static constexpr auto packages = "xf86-input-libinput xf86-video-fbdev xf86-video-vesa xf86-video-amdgpu xf86-video-ati xf86-video-intel xf86-video-nouveau"sv; auto* config_instance = Config::instance(); auto& config_data = config_instance->data(); @@ -54,8 +55,8 @@ static void setup_graphics_card() noexcept { /// TODO(vnepogodin): parse toml DBs { - static constexpr auto UseSpaceBar = "\nUse [Spacebar] to de/select options listed.\n"; - const auto& profile_names = ::detail::chwd::get_available_profile_names("graphic_drivers"); + static constexpr auto UseSpaceBar = "\nUse [Spacebar] to de/select options listed.\n"sv; + const auto& profile_names = ::detail::chwd::get_available_profile_names("graphic_drivers"sv); if (!profile_names.has_value()) { spdlog::error("failed to get profile names"); return; @@ -86,13 +87,13 @@ static void setup_graphics_card() noexcept { std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)}; #endif - graphics_card = utils::exec("lspci | grep -i \"vga\" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \\t]*//'"); + graphics_card = utils::exec("lspci | grep -i \"vga\" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \\t]*//'"sv); // All non-NVIDIA cards / virtualization if (!(utils::exec(fmt::format(FMT_COMPILE("echo \"{}\" | grep -i 'ati'"), graphics_card)).empty())) { install_ati(); #ifdef NDEVENV - } else if (driver == "video-nouveau") { + } else if (driver == "video-nouveau"sv) { utils::exec(fmt::format(FMT_COMPILE("sed -i 's/MODULES=\"\"/MODULES=\"nouveau\"/' {}/etc/mkinitcpio.conf"), mountpoint)); #endif } @@ -117,11 +118,11 @@ static void install_graphics_menu() noexcept { switch (selected) { #ifdef NDEVENV case 0: - utils::arch_chroot("chwd -a pci free 0300"); + utils::arch_chroot("chwd -a pci free 0300"sv); std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)}; break; case 1: - utils::arch_chroot("chwd -a pci nonfree 0300"); + utils::arch_chroot("chwd -a pci nonfree 0300"sv); std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)}; break; #endif