summaryrefslogtreecommitdiff
path: root/src/fs/paths.cpp
diff options
context:
space:
mode:
authorcpasjuste <cpasjuste@gmail.com>2020-04-22 15:24:08 +0200
committercpasjuste <cpasjuste@gmail.com>2020-04-22 15:24:08 +0200
commitf43e3aa48aeb561f5c7e85f1b7121aab6a61decd (patch)
tree1c23a1e1db2676c27a99b6385f0580442b29f7a0 /src/fs/paths.cpp
parentb0c696eaab501391512b08826c3c9a52023e2be7 (diff)
downloadmanaverse-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.tar.gz
manaverse-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.tar.bz2
manaverse-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.tar.xz
manaverse-f43e3aa48aeb561f5c7e85f1b7121aab6a61decd.zip
switch: first commit
Diffstat (limited to 'src/fs/paths.cpp')
-rw-r--r--src/fs/paths.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp
index 06186c7f0..036020fce 100644
--- a/src/fs/paths.cpp
+++ b/src/fs/paths.cpp
@@ -37,7 +37,7 @@
#include "utils/foreach.h"
#endif // USE_X11
-#ifdef __native_client__
+#if defined(__native_client__) || defined(__SWITCH__)
#define realpath(N, R) strcpy(R, N)
#endif // __native_client__
@@ -67,7 +67,7 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow")
#endif // ANDROID
PRAGMA48(GCC diagnostic pop)
-#ifdef __native_client__
+#if defined(__native_client__) || defined(__SWITCH__)
#ifndef SSIZE_MAX
#define SSIZE_MAX INT_MAX
#endif
@@ -92,7 +92,7 @@ std::string getRealPath(const std::string &str)
{
return std::string();
}
-#if defined(__OpenBSD__) || defined(__ANDROID__) || defined(__native_client__)
+#if defined(__OpenBSD__) || defined(__ANDROID__) || defined(__native_client__) || defined(__SWITCH__)
char *realPath = reinterpret_cast<char*>(calloc(PATH_MAX, sizeof(char)));
if (!realPath)
return "";
@@ -261,6 +261,9 @@ std::string getHomePath()
const char *path = getenv("HOME");
if (path == nullptr)
{
+#ifdef __SWITCH__
+ return "/switch/manaplus";
+#else
const uid_t uid = getuid();
const struct passwd *const pw = getpwuid(uid);
if (pw != nullptr &&
@@ -270,6 +273,7 @@ std::string getHomePath()
}
if (path == nullptr)
return dirSeparator;
+#endif
}
std::string dir = path;
if (findLast(dir, std::string(dirSeparator)) == false)