cl3/include/utils/local.hpp

18 lines
478 B
C++
Raw Permalink Normal View History

2023-04-15 21:23:12 +00:00
#pragma once
#include <unistd.h>
#include <filesystem>
#include <iostream>
inline std::filesystem::path GetLocalPath() {
const char* home_dir = getenv("HOME");
if (home_dir == nullptr) {
std::cerr << "Home directory was not declared" << std::endl;
throw std::runtime_error("Was not found home directory");
}
std::filesystem::path result = std::filesystem::path(home_dir) / ".local/share/cl3";
std::filesystem::create_directories(result);
return result;
}