summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2021-01-04 15:18:31 +0000
committerGitHub <noreply@github.com>2021-01-04 15:18:31 +0000
commitedd083601173c1b67a2e5cd88e23122f46b88bbf (patch)
treeab5e97daa087a900cfa19752437ce5e96c2e75e3 /src
parentdd5a732fa90550066bb96305b64b6648903cc822 (diff)
downloadminetest-edd083601173c1b67a2e5cd88e23122f46b88bbf.tar.gz
minetest-edd083601173c1b67a2e5cd88e23122f46b88bbf.tar.bz2
minetest-edd083601173c1b67a2e5cd88e23122f46b88bbf.zip
ContentDB: Add overwrite dialog when content is already installed (#10768)
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp11
-rw-r--r--src/script/lua_api/l_mainmenu.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 0b0b2de3b..5070ec7d4 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -804,6 +804,15 @@ int ModApiMainMenu::l_copy_dir(lua_State *L)
}
/******************************************************************************/
+int ModApiMainMenu::l_is_dir(lua_State *L)
+{
+ const char *path = luaL_checkstring(L, 1);
+
+ lua_pushboolean(L, fs::IsDir(path));
+ return 1;
+}
+
+/******************************************************************************/
int ModApiMainMenu::l_extract_zip(lua_State *L)
{
const char *zipfile = luaL_checkstring(L, 1);
@@ -1139,6 +1148,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(create_dir);
API_FCT(delete_dir);
API_FCT(copy_dir);
+ API_FCT(is_dir);
API_FCT(extract_zip);
API_FCT(may_modify_path);
API_FCT(get_mainmenu_path);
@@ -1172,6 +1182,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
API_FCT(create_dir);
API_FCT(delete_dir);
API_FCT(copy_dir);
+ API_FCT(is_dir);
//API_FCT(extract_zip); //TODO remove dependency to GuiEngine
API_FCT(may_modify_path);
API_FCT(download_file);
diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h
index faa2bf273..0b02ed892 100644
--- a/src/script/lua_api/l_mainmenu.h
+++ b/src/script/lua_api/l_mainmenu.h
@@ -132,6 +132,8 @@ private:
static int l_copy_dir(lua_State *L);
+ static int l_is_dir(lua_State *L);
+
static int l_extract_zip(lua_State *L);
static int l_may_modify_path(lua_State *L);