aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/defaultsettings.cpp1
-rw-r--r--src/porting.h40
-rw-r--r--src/script/cpp_api/s_base.cpp4
3 files changed, 44 insertions, 1 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 4f297c099..e7b0e3745 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -289,7 +289,6 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_particles", "false");
settings->setDefault("video_driver", "ogles1");
settings->setDefault("touchtarget", "true");
- settings->setDefault("main_menu_script","/sdcard/Minetest/builtin/mainmenu/init_android.lua");
settings->setDefault("TMPFolder","/sdcard/Minetest/tmp/");
settings->setDefault("touchscreen_threshold","20");
settings->setDefault("smooth_lighting", "false");
diff --git a/src/porting.h b/src/porting.h
index 9be09da75..b6f71103d 100644
--- a/src/porting.h
+++ b/src/porting.h
@@ -371,6 +371,46 @@ v2u32 getDisplaySize();
v2u32 getWindowSize();
#endif
+inline const char * getPlatformName()
+{
+ return
+#if defined(ANDROID)
+ "Android"
+#elif defined(linux) || defined(__linux) || defined(__linux__)
+ "Linux"
+#elif defined(_WIN32) || defined(_WIN64)
+ "Windows"
+#elif defined(__DragonFly__) || defined(__FreeBSD__) || \
+ defined(__NetBSD__) || defined(__OpenBSD__)
+ "BSD"
+#elif defined(__APPLE__) && defined(__MACH__)
+ #if TARGET_OS_MAC
+ "OSX"
+ #elif TARGET_OS_IPHONE
+ "iOS"
+ #else
+ "Apple"
+ #endif
+#elif defined(_AIX)
+ "AIX"
+#elif defined(__hpux)
+ "HP-UX"
+#elif defined(__sun) && defined(__SVR4)
+ "Solaris"
+#elif defined(__CYGWIN__)
+ "Cygwin"
+#elif defined(__unix__) || defined(__unix)
+ #if defined(_POSIX_VERSION)
+ "Posix"
+ #else
+ "Unix"
+ #endif
+#else
+ "?"
+#endif
+ ;
+}
+
} // namespace porting
#ifdef __ANDROID__
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp
index 779819007..1f96373dc 100644
--- a/src/script/cpp_api/s_base.cpp
+++ b/src/script/cpp_api/s_base.cpp
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h"
#include "log.h"
#include "mods.h"
+#include "porting.h"
#include "util/string.h"
@@ -98,6 +99,9 @@ ScriptApiBase::ScriptApiBase()
lua_pushstring(m_luastack, DIR_DELIM);
lua_setglobal(m_luastack, "DIR_DELIM");
+ lua_pushstring(m_luastack, porting::getPlatformName());
+ lua_setglobal(m_luastack, "PLATFORM");
+
m_server = NULL;
m_environment = NULL;
m_guiengine = NULL;