mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Feat: load config in libagent to prepare for modules
- Make runtime_dir optional in JuiceAgent.init (tolerate null jstring) - Load config.toml into Agent and expose getConfig/setConfig - Warn instead of failing when runtime directory or config is missing
This commit is contained in:
1 parent
51bcfbd549
commit
2ab1c134ed
3 files changed
+30
-7
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include <string>
|
||||
#include <JuiceAgent/Logger.hpp>
|
||||
#include <JuiceAgent.hpp>
|
||||
#include <JuiceAgent/Config.hpp>
|
||||
#include <jni_common.hpp>
|
||||
|
||||
namespace JuiceAgent {
|
||||
@@ -29,6 +30,18 @@ namespace JuiceAgent {
|
||||
spdlog::error("[JuiceAgent] Could not get JVMTI!");
|
||||
return false;
|
||||
}
|
||||
if(runtime_dir.empty()) {
|
||||
spdlog::warn("[JuiceAgent] No runtime directory specified!");
|
||||
spdlog::warn("[JuiceAgent] No config provided, Modules will not be loaded!");
|
||||
} else {
|
||||
JuiceAgent::Config::Config cfg(runtime_dir);
|
||||
setConfig(cfg);
|
||||
if(!getConfig().is_valid()) {
|
||||
spdlog::warn("[JuiceAgent] Config is not valid!");
|
||||
spdlog::warn("[JuiceAgent] No config provided, Modules will not be loaded!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set Environment
|
||||
setJavaVM(jvm);
|
||||
|
||||
Reference in new issue
Block a user