mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Move archive extraction in content store to async job
This commit is contained in:
parent
2d5b7b5fb4
commit
2b5075f0e2
6 changed files with 47 additions and 105 deletions
|
@ -563,7 +563,10 @@ int ModApiMainMenu::l_get_cache_path(lua_State *L)
|
|||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_get_temp_path(lua_State *L)
|
||||
{
|
||||
lua_pushstring(L, fs::TempPath().c_str());
|
||||
if (lua_isnoneornil(L, 1) || !lua_toboolean(L, 1))
|
||||
lua_pushstring(L, fs::TempPath().c_str());
|
||||
else
|
||||
lua_pushstring(L, fs::CreateTempFile().c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -770,8 +773,9 @@ int ModApiMainMenu::l_get_video_drivers(lua_State *L)
|
|||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_gettext(lua_State *L)
|
||||
{
|
||||
std::string text = strgettext(std::string(luaL_checkstring(L, 1)));
|
||||
lua_pushstring(L, text.c_str());
|
||||
const char *srctext = luaL_checkstring(L, 1);
|
||||
const char *text = *srctext ? gettext(srctext) : "";
|
||||
lua_pushstring(L, text);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -921,5 +925,5 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
|
|||
API_FCT(download_file);
|
||||
API_FCT(get_min_supp_proto);
|
||||
API_FCT(get_max_supp_proto);
|
||||
//API_FCT(gettext); (gettext lib isn't threadsafe)
|
||||
API_FCT(gettext);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue