diff --git a/include/CrossLang.hpp b/include/CrossLang.hpp index ba74c49..d0d05ec 100644 --- a/include/CrossLang.hpp +++ b/include/CrossLang.hpp @@ -27,6 +27,7 @@ namespace Tesses::CrossLang { std::string EscapeString(std::string text,bool quote); Tesses::Framework::Filesystem::VFSPath GetRealExecutablePath(Tesses::Framework::Filesystem::VFSPath realPath); + Tesses::Framework::Filesystem::VFSPath GetCrossLangConfigDir(); enum TVMVersionStage : uint8_t { @@ -1570,4 +1571,4 @@ class GC { void LoadPlugin(GC* gc, TRootEnvironment* env, Tesses::Framework::Filesystem::VFSPath sharedObjectPath); std::string Json_Encode(TObject o,bool indent=false); TObject Json_Decode(GCList ls,std::string str); -}; \ No newline at end of file +}; diff --git a/src/runtime_methods/env.cpp b/src/runtime_methods/env.cpp index bcd712d..7eaa138 100644 --- a/src/runtime_methods/env.cpp +++ b/src/runtime_methods/env.cpp @@ -14,6 +14,17 @@ namespace Tesses::CrossLang static char EnvPathSeperator=':'; #endif + Tesses::Framework::Filesystem::VFSPath GetCrossLangConfigDir() + { + Tesses::Framework::Filesystem::VFSPath p; + #if defined(CROSSLANG_ENABLE_PLATFORM_FOLDERS) + p=sago::getConfigHome(); + #else + p = GetHomeFolder() + "/Config"; + #endif + return p / "Tesses" / "CrossLang"; + } + Tesses::Framework::Filesystem::VFSPath GetRealExecutablePath(Tesses::Framework::Filesystem::VFSPath realPath) { using namespace Tesses::Framework::Filesystem; @@ -57,6 +68,10 @@ namespace Tesses::CrossLang return "/CrossLangProfile"; #endif } + static TObject Env_getCrossLangConfig(GCList& ls, std::vector args) + { + return GetCrossLangConfigDir(); + } static TObject Env_getPlatform(GCList& ls, std::vector args) { #if defined(__SWITCH__) @@ -249,6 +264,7 @@ namespace Tesses::CrossLang dict->DeclareFunction(gc,"getState","Get state folder",{},Env_getState); dict->DeclareFunction(gc,"getCache","Get cache folder",{},Env_getCache); dict->DeclareFunction(gc,"getConfig","Get config folder",{},Env_getConfig); + dict->DeclareFunction(gc,"getCrossLangConfig","Get crosslang configuration folder",{}, Env_getCrossLangConfig); dict->DeclareFunction(gc,"getData","Get data folder",{},Env_getData); dict->DeclareFunction(gc,"getUser","Get user folder",{},Env_getUser); dict->DeclareFunction(gc,"getPlatform","Get platform name",{},Env_getPlatform);