- [NEW] Function "configfolder()"
This commit is contained in:
@@ -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() {
|
void file_loadconfigvalues() {
|
||||||
config.clear();
|
config.clear();
|
||||||
std::string config_file = config_folder + "/config.txt";
|
std::string config_file = config_folder + "/config.txt";
|
||||||
|
|||||||
1
jfile.h
1
jfile.h
@@ -5,6 +5,7 @@
|
|||||||
#define SOURCE_FOLDER 1
|
#define SOURCE_FOLDER 1
|
||||||
|
|
||||||
void file_setconfigfolder(const char *foldername);
|
void file_setconfigfolder(const char *foldername);
|
||||||
|
const char *file_getconfigfolder();
|
||||||
|
|
||||||
void file_setresourcefilename(const char *str);
|
void file_setresourcefilename(const char *str);
|
||||||
void file_setresourcefolder(const char *str);
|
void file_setresourcefolder(const char *str);
|
||||||
|
|||||||
6
lua.cpp
6
lua.cpp
@@ -777,6 +777,11 @@ extern "C" {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cpp_configfolder(lua_State *L) {
|
||||||
|
lua_pushstring(L, configfolder());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int cpp_exit(lua_State *L) {
|
static int cpp_exit(lua_State *L) {
|
||||||
exit();
|
exit();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -897,6 +902,7 @@ void push_lua_funcs() {
|
|||||||
|
|
||||||
lua_pushcfunction(L,cpp_getconf); lua_setglobal(L, "getconf");
|
lua_pushcfunction(L,cpp_getconf); lua_setglobal(L, "getconf");
|
||||||
lua_pushcfunction(L,cpp_setconf); lua_setglobal(L, "setconf");
|
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");
|
lua_pushcfunction(L,cpp_exit); lua_setglobal(L, "quit");
|
||||||
|
|
||||||
|
|||||||
4
mini.cpp
4
mini.cpp
@@ -1207,6 +1207,10 @@ void setconfig(const char* key, const char* value) {
|
|||||||
file_setconfigvalue(key, value);
|
file_setconfigvalue(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *configfolder() {
|
||||||
|
return file_getconfigfolder();
|
||||||
|
}
|
||||||
|
|
||||||
void exit() {
|
void exit() {
|
||||||
should_exit = true;
|
should_exit = true;
|
||||||
should_quit = true;
|
should_quit = true;
|
||||||
|
|||||||
3
mini.h
3
mini.h
@@ -281,7 +281,8 @@ void setfullscreen(const bool value);
|
|||||||
bool getcursor();
|
bool getcursor();
|
||||||
void setcursor(const bool value);
|
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);
|
void setconfig(const char* key, const char* value);
|
||||||
|
const char *configfolder();
|
||||||
|
|
||||||
void exit();
|
void exit();
|
||||||
|
|||||||
Reference in New Issue
Block a user