From 4baf56520d61e22687b563d403f5d873251e135f Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 5 Jun 2022 17:42:09 +0100 Subject: Android: Add support for sharing debug.txt (#12370) --- src/script/lua_api/l_mainmenu.cpp | 14 ++++++++++++++ src/script/lua_api/l_mainmenu.h | 2 ++ 2 files changed, 16 insertions(+) (limited to 'src/script/lua_api') diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index f7b2393fb..4a847ed6d 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -876,6 +876,19 @@ int ModApiMainMenu::l_open_dir(lua_State *L) return 1; } +/******************************************************************************/ +int ModApiMainMenu::l_share_file(lua_State *L) +{ +#ifdef __ANDROID__ + std::string path = luaL_checkstring(L, 1); + porting::shareFileAndroid(path); + lua_pushboolean(L, true); +#else + lua_pushboolean(L, false); +#endif + return 1; +} + /******************************************************************************/ int ModApiMainMenu::l_do_async_callback(lua_State *L) { @@ -941,6 +954,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(get_max_supp_proto); API_FCT(open_url); API_FCT(open_dir); + API_FCT(share_file); API_FCT(do_async_callback); } diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index 781185425..6ceff6dd7 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -152,6 +152,8 @@ private: static int l_open_dir(lua_State *L); + static int l_share_file(lua_State *L); + // async static int l_do_async_callback(lua_State *L); -- cgit v1.2.3