mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add open user data button to main menu (#10579)
This commit is contained in:
parent
025035db5c
commit
664f5ce960
9 changed files with 100 additions and 19 deletions
|
@ -686,6 +686,14 @@ int ModApiMainMenu::l_get_mapgen_names(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_get_user_path(lua_State *L)
|
||||
{
|
||||
std::string path = fs::RemoveRelativePathComponents(porting::path_user);
|
||||
lua_pushstring(L, path.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_get_modpath(lua_State *L)
|
||||
{
|
||||
|
@ -1067,7 +1075,15 @@ int ModApiMainMenu::l_get_max_supp_proto(lua_State *L)
|
|||
int ModApiMainMenu::l_open_url(lua_State *L)
|
||||
{
|
||||
std::string url = luaL_checkstring(L, 1);
|
||||
lua_pushboolean(L, porting::openURL(url));
|
||||
lua_pushboolean(L, porting::open_url(url));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_open_dir(lua_State *L)
|
||||
{
|
||||
std::string path = luaL_checkstring(L, 1);
|
||||
lua_pushboolean(L, porting::open_directory(path));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1113,6 +1129,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
|
|||
API_FCT(set_background);
|
||||
API_FCT(set_topleft_text);
|
||||
API_FCT(get_mapgen_names);
|
||||
API_FCT(get_user_path);
|
||||
API_FCT(get_modpath);
|
||||
API_FCT(get_clientmodpath);
|
||||
API_FCT(get_gamepath);
|
||||
|
@ -1134,6 +1151,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
|
|||
API_FCT(get_min_supp_proto);
|
||||
API_FCT(get_max_supp_proto);
|
||||
API_FCT(open_url);
|
||||
API_FCT(open_dir);
|
||||
API_FCT(do_async_callback);
|
||||
}
|
||||
|
||||
|
@ -1144,6 +1162,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
|
|||
API_FCT(get_games);
|
||||
API_FCT(get_favorites);
|
||||
API_FCT(get_mapgen_names);
|
||||
API_FCT(get_user_path);
|
||||
API_FCT(get_modpath);
|
||||
API_FCT(get_clientmodpath);
|
||||
API_FCT(get_gamepath);
|
||||
|
|
|
@ -112,6 +112,8 @@ private:
|
|||
|
||||
static int l_get_mainmenu_path(lua_State *L);
|
||||
|
||||
static int l_get_user_path(lua_State *L);
|
||||
|
||||
static int l_get_modpath(lua_State *L);
|
||||
|
||||
static int l_get_clientmodpath(lua_State *L);
|
||||
|
@ -148,6 +150,8 @@ private:
|
|||
// other
|
||||
static int l_open_url(lua_State *L);
|
||||
|
||||
static int l_open_dir(lua_State *L);
|
||||
|
||||
|
||||
// async
|
||||
static int l_do_async_callback(lua_State *L);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue