fix config path
This commit is contained in:
parent
1621b47975
commit
4d16211b6c
@ -62,6 +62,14 @@ namespace util
|
||||
return (*c);
|
||||
}
|
||||
|
||||
std::string GetModulePath(HMODULE hModule /*= nullptr*/)
|
||||
{
|
||||
char pathOut[MAX_PATH] = {};
|
||||
GetModuleFileNameA(hModule, pathOut, MAX_PATH);
|
||||
|
||||
return std::filesystem::path(pathOut).parent_path().string();
|
||||
}
|
||||
|
||||
std::optional<std::string> SelectDirectory(const char* title)
|
||||
{
|
||||
auto currPath = std::filesystem::current_path();
|
||||
|
@ -36,6 +36,8 @@ namespace util
|
||||
std::string GetLastErrorAsString(DWORD errorId = 0);
|
||||
int64_t GetCurrentTimeMillisec();
|
||||
|
||||
std::string GetModulePath(HMODULE hModule = nullptr);
|
||||
|
||||
std::vector<std::string> StringSplit(const std::string& delimiter, const std::string& content);
|
||||
std::string SplitWords(const std::string& value);
|
||||
std::string MakeCapital(std::string value);
|
||||
|
@ -15,15 +15,16 @@ void Run(HMODULE* phModule)
|
||||
{
|
||||
ResourceLoader::SetModuleHandle(*phModule);
|
||||
|
||||
auto cheatDir = std::filesystem::path(util::GetModulePath(*phModule)).parent_path();
|
||||
|
||||
// Init config
|
||||
std::string configPath = (std::filesystem::current_path() / "cfg.json").string();
|
||||
config::Initialize(configPath);
|
||||
config::Initialize((cheatDir / "cfg.json").string());
|
||||
|
||||
// Init logger
|
||||
auto& settings = cheat::feature::Settings::GetInstance();
|
||||
if (settings.f_FileLogging)
|
||||
{
|
||||
Logger::PrepareFileLogging((std::filesystem::current_path() / "logs").string());
|
||||
Logger::PrepareFileLogging((cheatDir / "logs").string());
|
||||
Logger::SetLevel(Logger::Level::Trace, Logger::LoggerType::FileLogger);
|
||||
}
|
||||
|
||||
@ -55,5 +56,5 @@ void Run(HMODULE* phModule)
|
||||
|
||||
cheat::Init();
|
||||
|
||||
LOG_DEBUG("Config path is at %s", configPath.c_str());
|
||||
LOG_DEBUG("Config path is at %s", (cheatDir / "cfg.json").string().c_str());
|
||||
}
|
Loading…
Reference in New Issue
Block a user