mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
Impl: Config system - check env
This commit is contained in:
1 parent
174197badb
commit
2f7eb532a7
1 file changed
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <JuiceAgent/Logger.hpp>
|
||||
|
||||
namespace JuiceAgent::Config
|
||||
{
|
||||
class Config {
|
||||
private:
|
||||
std::filesystem::path config_dir;
|
||||
public:
|
||||
Config(std::filesystem::path config_dir) : config_dir(config_dir){
|
||||
// Check if config_dir exists
|
||||
if (!std::filesystem::exists(config_dir)){
|
||||
PLOGE << "Config directory does not exist" << config_dir;
|
||||
return;
|
||||
}
|
||||
|
||||
std::filesystem::path config_file = config_dir / "config.toml";
|
||||
// Check if config file exists
|
||||
if (!std::filesystem::exists(config_file)){
|
||||
PLOGE << "Config file does not exist" << config_file;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
} // namespace JuiceAgent::Config
|
||||
Reference in new issue
Block a user