summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/mkdir.cpp6
-rw-r--r--src/utils/paths.cpp13
-rw-r--r--src/utils/paths.h4
-rw-r--r--src/utils/process.cpp6
4 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp
index d61fae919..d4005f4ab 100644
--- a/src/utils/mkdir.cpp
+++ b/src/utils/mkdir.cpp
@@ -40,6 +40,9 @@
#if defined WIN32
int mkdir_r(const char *const pathname)
{
+ if (!pathname)
+ return -1;
+
char tmp[PATH_MAX];
char tmp2[PATH_MAX];
char *p;
@@ -111,6 +114,9 @@ int mkdir_r(const char *const pathname)
/// Create a directory, making leading components first if necessary
int mkdir_r(const char *const pathname)
{
+ if (!pathname)
+ return -1;
+
const size_t len = static_cast<size_t>(strlen(pathname));
char *tmp = new char[len + 2];
char *p;
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index dd045cb5a..dbbdf6b31 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -39,6 +39,12 @@
#include <limits.h>
#endif
+#ifdef ANDROID
+#ifdef USE_SDL2
+#include <SDL_system.h>
+#endif
+#endif
+
#include "debug.h"
std::string getRealPath(const std::string &str)
@@ -175,3 +181,10 @@ std::string getDesktopDir()
return std::string(PhysFs::getUserDir()).append("Desktop");
#endif
}
+
+#ifdef ANDROID
+std::string getSdStoragePath()
+{
+ return getenv("DATADIR2");
+}
+#endif
diff --git a/src/utils/paths.h b/src/utils/paths.h
index 0c36b2f66..6e2d17808 100644
--- a/src/utils/paths.h
+++ b/src/utils/paths.h
@@ -39,4 +39,8 @@ std::string getSelfName() A_WARN_UNUSED;
std::string getDesktopDir() A_WARN_UNUSED;
+#ifdef ANDROID
+std::string getSdStoragePath() A_WARN_UNUSED;
+#endif
+
#endif // UTILS_PATHS_H
diff --git a/src/utils/process.cpp b/src/utils/process.cpp
index 1859b1c2f..efd799987 100644
--- a/src/utils/process.cpp
+++ b/src/utils/process.cpp
@@ -238,10 +238,16 @@ bool openBrowser(std::string url)
}
#elif defined ANDROID
#include "utils/stringutils.h"
+#ifndef USE_SDL2
#include <SDL_screenkeyboard.h>
+#endif
bool openBrowser(std::string url)
{
+#ifdef USE_SDL2
+ // +++ need add support
+#else
SDL_ANDROID_OpenBrowser(replaceAll(url, " ", "").c_str());
+#endif
return true;
}
#elif defined __APPLE__