mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Use consistent temp folder path (#10892)
This commit is contained in:
parent
4caf156be5
commit
3a8c37181a
6 changed files with 24 additions and 33 deletions
|
@ -461,7 +461,6 @@ void set_default_settings()
|
|||
settings->setDefault("screen_h", "0");
|
||||
settings->setDefault("fullscreen", "true");
|
||||
settings->setDefault("touchtarget", "true");
|
||||
settings->setDefault("TMPFolder", porting::path_cache);
|
||||
settings->setDefault("touchscreen_threshold","20");
|
||||
settings->setDefault("fixed_virtual_joystick", "false");
|
||||
settings->setDefault("virtual_joystick_triggers_aux", "false");
|
||||
|
|
|
@ -27,9 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "log.h"
|
||||
#include "config.h"
|
||||
#include "porting.h"
|
||||
#ifdef __ANDROID__
|
||||
#include "settings.h" // For g_settings
|
||||
#endif
|
||||
|
||||
namespace fs
|
||||
{
|
||||
|
@ -359,8 +356,9 @@ std::string TempPath()
|
|||
compatible with lua's os.tmpname which under the default
|
||||
configuration hardcodes mkstemp("/tmp/lua_XXXXXX").
|
||||
*/
|
||||
|
||||
#ifdef __ANDROID__
|
||||
return g_settings->get("TMPFolder");
|
||||
return porting::path_cache;
|
||||
#else
|
||||
return DIR_DELIM "tmp";
|
||||
#endif
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -122,6 +122,8 @@ private:
|
|||
|
||||
static int l_get_cache_path(lua_State *L);
|
||||
|
||||
static int l_get_temp_path(lua_State *L);
|
||||
|
||||
static int l_create_dir(lua_State *L);
|
||||
|
||||
static int l_delete_dir(lua_State *L);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue