Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
config.cpp
Go to the documentation of this file.
3#include <iostream>
5
7 base_path = "tests/e2e/current/tmp/arkanjo";
8}
9
11 // BASE PATH
12 const char* cache_env = std::getenv("XDG_CACHE_HOME");
13 const char* home = std::getenv("HOME");
14
15 if (cache_env) {
16 base_path = fs::path(cache_env) / program_name;
17 } else if (home) {
18 base_path = fs::path(home) / ".cache" / program_name;
19 } else {
20 FormatterManager::warn("neither XDG_CACHE_HOME nor HOME is set. Using default path.");
21 }
22
23 // THEME
27
28 // THIRD PARTY
29 std::filesystem::path path = THIRD_PARTY_DIR;
30 if (std::filesystem::exists(path)) {
31 third_party_dir = path;
32 } else if (!std::filesystem::exists(third_party_dir)) {
33 throw std::runtime_error("Could not locate third-party directory");
34 }
35}
36
38 static Config instance;
39 return instance;
40}
Singleton configuration manager class.
Definition config.hpp:33
static Config & config()
Gets the singleton configuration instance.
Definition config.cpp:37
void setDefaultConfig()
Sets default production configuration paths.
Definition config.cpp:10
config::Theme theme
Current terminal theme.
Definition config.hpp:45
void setTestConfig()
Sets test configuration paths.
Definition config.cpp:6
std::string program_name
Name of the program.
Definition config.hpp:41
fs::path third_party_dir
Directory containing third-party dependencies.
Definition config.hpp:43
fs::path base_path
Default base path for temporary files.
Definition config.hpp:42
static void warn(const std::string &str)
static bool is_bg_color_dark()
Determines if terminal background color is dark.
Configuration management interface.
#define THIRD_PARTY_DIR
Definition config.hpp:24
Defines utility functions used across all files.