35 if (
auto const userprofile_dir = std::getenv(
"USERPROFILE")) {
36 return std::filesystem::path(userprofile_dir);
38 throw std::runtime_error(
"%USERPROFILE% not set");
41 if (
auto const home_dir = std::getenv(
"HOME")) {
42 return std::filesystem::path(home_dir);
44 throw std::runtime_error(
"$HOME not set");
48 if (
auto const userprofile_dir = std::getenv(
"USERPROFILE")) {
49 return std::filesystem::path(userprofile_dir);
51 throw std::runtime_error(
"%USERPROFILE% not set");
54 if (
auto const home_dir = std::getenv(
"HOME")) {
55 return std::filesystem::path(home_dir);
57 throw std::runtime_error(
"$HOME not set");
62inline std::vector<std::string>
split(std::string s, std::string delimiter) {
63 size_t pos_start = 0, pos_end, delim_len = delimiter.length();
65 std::vector<std::string> res;
67 while ((pos_end = s.find(delimiter, pos_start)) != std::string::npos) {
68 token = s.substr(pos_start, pos_end - pos_start);
69 pos_start = pos_end + delim_len;
73 res.push_back(s.substr(pos_start));