diff --git a/jfile.cpp b/jfile.cpp index 0a40cad..e0e9d98 100644 --- a/jfile.cpp +++ b/jfile.cpp @@ -170,6 +170,11 @@ void file_setconfigfolder(const char *foldername) } } +const char *file_getconfigfolder() { + std::string folder = config_folder + "/"; + return folder.c_str(); +} + void file_loadconfigvalues() { config.clear(); std::string config_file = config_folder + "/config.txt"; diff --git a/jfile.h b/jfile.h index 1b401e3..560d602 100644 --- a/jfile.h +++ b/jfile.h @@ -5,6 +5,7 @@ #define SOURCE_FOLDER 1 void file_setconfigfolder(const char *foldername); +const char *file_getconfigfolder(); void file_setresourcefilename(const char *str); void file_setresourcefolder(const char *str); diff --git a/lua.cpp b/lua.cpp index 457d2e5..cea7739 100644 --- a/lua.cpp +++ b/lua.cpp @@ -777,6 +777,11 @@ extern "C" { return 0; } + static int cpp_configfolder(lua_State *L) { + lua_pushstring(L, configfolder()); + return 1; + } + static int cpp_exit(lua_State *L) { exit(); return 0; @@ -897,6 +902,7 @@ void push_lua_funcs() { lua_pushcfunction(L,cpp_getconf); lua_setglobal(L, "getconf"); lua_pushcfunction(L,cpp_setconf); lua_setglobal(L, "setconf"); + lua_pushcfunction(L,cpp_configfolder); lua_setglobal(L, "configfolder"); lua_pushcfunction(L,cpp_exit); lua_setglobal(L, "quit"); diff --git a/mini.cpp b/mini.cpp index 896c501..3e89a11 100644 --- a/mini.cpp +++ b/mini.cpp @@ -1207,6 +1207,10 @@ void setconfig(const char* key, const char* value) { file_setconfigvalue(key, value); } +const char *configfolder() { + return file_getconfigfolder(); +} + void exit() { should_exit = true; should_quit = true; diff --git a/mini.h b/mini.h index a8d4e0b..95dc7cb 100644 --- a/mini.h +++ b/mini.h @@ -281,7 +281,8 @@ void setfullscreen(const bool value); bool getcursor(); void setcursor(const bool value); -const char* getconfig(const char* key); +const char *getconfig(const char* key); void setconfig(const char* key, const char* value); +const char *configfolder(); void exit();