Make crosslang configdir accessable from C++

This commit is contained in:
2025-04-07 02:12:26 -05:00
parent d816f48488
commit a0076e446a
2 changed files with 18 additions and 1 deletions

View File

@ -27,6 +27,7 @@ namespace Tesses::CrossLang {
std::string EscapeString(std::string text,bool quote); std::string EscapeString(std::string text,bool quote);
Tesses::Framework::Filesystem::VFSPath GetRealExecutablePath(Tesses::Framework::Filesystem::VFSPath realPath); Tesses::Framework::Filesystem::VFSPath GetRealExecutablePath(Tesses::Framework::Filesystem::VFSPath realPath);
Tesses::Framework::Filesystem::VFSPath GetCrossLangConfigDir();
enum TVMVersionStage : uint8_t enum TVMVersionStage : uint8_t
{ {
@ -1570,4 +1571,4 @@ class GC {
void LoadPlugin(GC* gc, TRootEnvironment* env, Tesses::Framework::Filesystem::VFSPath sharedObjectPath); void LoadPlugin(GC* gc, TRootEnvironment* env, Tesses::Framework::Filesystem::VFSPath sharedObjectPath);
std::string Json_Encode(TObject o,bool indent=false); std::string Json_Encode(TObject o,bool indent=false);
TObject Json_Decode(GCList ls,std::string str); TObject Json_Decode(GCList ls,std::string str);
}; };

View File

@ -14,6 +14,17 @@ namespace Tesses::CrossLang
static char EnvPathSeperator=':'; static char EnvPathSeperator=':';
#endif #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) Tesses::Framework::Filesystem::VFSPath GetRealExecutablePath(Tesses::Framework::Filesystem::VFSPath realPath)
{ {
using namespace Tesses::Framework::Filesystem; using namespace Tesses::Framework::Filesystem;
@ -57,6 +68,10 @@ namespace Tesses::CrossLang
return "/CrossLangProfile"; return "/CrossLangProfile";
#endif #endif
} }
static TObject Env_getCrossLangConfig(GCList& ls, std::vector<TObject> args)
{
return GetCrossLangConfigDir();
}
static TObject Env_getPlatform(GCList& ls, std::vector<TObject> args) static TObject Env_getPlatform(GCList& ls, std::vector<TObject> args)
{ {
#if defined(__SWITCH__) #if defined(__SWITCH__)
@ -249,6 +264,7 @@ namespace Tesses::CrossLang
dict->DeclareFunction(gc,"getState","Get state folder",{},Env_getState); dict->DeclareFunction(gc,"getState","Get state folder",{},Env_getState);
dict->DeclareFunction(gc,"getCache","Get cache folder",{},Env_getCache); dict->DeclareFunction(gc,"getCache","Get cache folder",{},Env_getCache);
dict->DeclareFunction(gc,"getConfig","Get config folder",{},Env_getConfig); 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,"getData","Get data folder",{},Env_getData);
dict->DeclareFunction(gc,"getUser","Get user folder",{},Env_getUser); dict->DeclareFunction(gc,"getUser","Get user folder",{},Env_getUser);
dict->DeclareFunction(gc,"getPlatform","Get platform name",{},Env_getPlatform); dict->DeclareFunction(gc,"getPlatform","Get platform name",{},Env_getPlatform);