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

Use consistent temp folder path (#10892)

This commit is contained in:
rubenwardy 2021-02-07 15:27:24 +00:00 committed by GitHub
parent 4caf156be5
commit 3a8c37181a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 33 deletions

View file

@ -529,6 +529,7 @@ int ModApiMainMenu::l_get_texturepath(lua_State *L)
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_get_texturepath_share(lua_State *L)
{
std::string gamepath = fs::RemoveRelativePathComponents(
@ -537,12 +538,20 @@ int ModApiMainMenu::l_get_texturepath_share(lua_State *L)
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_get_cache_path(lua_State *L)
{
lua_pushstring(L, fs::RemoveRelativePathComponents(porting::path_cache).c_str());
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_get_temp_path(lua_State *L)
{
lua_pushstring(L, fs::TempPath().c_str());
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_create_dir(lua_State *L) {
const char *path = luaL_checkstring(L, 1);
@ -942,6 +951,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_texturepath);
API_FCT(get_texturepath_share);
API_FCT(get_cache_path);
API_FCT(get_temp_path);
API_FCT(create_dir);
API_FCT(delete_dir);
API_FCT(copy_dir);
@ -975,6 +985,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
API_FCT(get_texturepath);
API_FCT(get_texturepath_share);
API_FCT(get_cache_path);
API_FCT(get_temp_path);
API_FCT(create_dir);
API_FCT(delete_dir);
API_FCT(copy_dir);