#include "fs.hpp" #include #include #include auto get_current_user_home_path() noexcept -> std::filesystem::path { const auto *home_path_env = std::getenv("HOME"); if (home_path_env == nullptr) { return getpwuid(getuid())->pw_dir; } return home_path_env; } auto expand_path_home(const std::filesystem::path &path) noexcept -> std::filesystem::path { const auto path_str = path.string(); if (!path_str.starts_with("~/")) { return path; } return get_current_user_home_path() / std::filesystem::path(path_str.substr(2)); }