1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Make fs::extractZipFile thread-safe

This commit is contained in:
sfan5 2021-09-19 16:55:35 +02:00
parent 9fab5d594c
commit 2d5b7b5fb4
3 changed files with 69 additions and 55 deletions

View file

@ -644,9 +644,9 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)
std::string absolute_destination = fs::RemoveRelativePathComponents(destination);
if (ModApiMainMenu::mayModifyPath(absolute_destination)) {
auto rendering_engine = getGuiEngine(L)->m_rendering_engine;
fs::CreateAllDirs(absolute_destination);
lua_pushboolean(L, fs::extractZipFile(rendering_engine->get_filesystem(), zipfile, destination));
auto fs = RenderingEngine::get_raw_device()->getFileSystem();
bool ok = fs::extractZipFile(fs, zipfile, destination);
lua_pushboolean(L, ok);
return 1;
}
@ -916,7 +916,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
API_FCT(delete_dir);
API_FCT(copy_dir);
API_FCT(is_dir);
//API_FCT(extract_zip); //TODO remove dependency to GuiEngine
API_FCT(extract_zip);
API_FCT(may_modify_path);
API_FCT(download_file);
API_FCT(get_min_supp_proto);