#include "IconRegistry.hpp" #include #include #include #include IconTheme::IconTheme(std::filesystem::path const &themes_directory_path) { for (auto const &dir : std::filesystem::directory_iterator(themes_directory_path)) { if (!dir.is_directory()) continue; auto const index_path = dir.path() / "index.theme"; if (std::filesystem::is_regular_file(index_path)) continue; } } IconRegistry::IconRegistry() { std::vector theme_directory_paths; { auto const *env { getenv("HOME") }; if (env && *env) { theme_directory_paths.push_back( std::filesystem::path(env) / ".icons"); } } { auto const *env { getenv("XDG_DATA_DIRS") }; if (env && *env) { theme_directory_paths.push_back( std::filesystem::path(env) / "icons"); } } { std::filesystem::path const path { "/usr/share/pixmaps" }; if (std::filesystem::exists(path)) theme_directory_paths.push_back(path); } for (auto const &path : std::move(theme_directory_paths) | std::views::filter([](std::filesystem::path &path) { return std::filesystem::is_directory(path); })) { try { m_themes.push_back({ path }); } catch (...) { } } if (m_themes.empty()) { throw std::runtime_error("Could not find any icon themes."); } }