From 3d02e533eb6ea53aceb7bc32a676e0d7d8195658 Mon Sep 17 00:00:00 2001
From: Jari Vetoniemi <jari.vetoniemi@indooratlas.com>
Date: Wed, 11 Mar 2020 23:06:57 +0900
Subject: [PATCH] Different cwd for android

---
 src/main.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/main.cpp b/src/main.cpp
index e457639..6d013f5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -220,6 +220,14 @@ int main(int argc, char *argv[])
 	}
 #endif
 
+#ifdef __ANDROID__
+	const char *android_path = SDL_AndroidGetInternalStoragePath();
+	if (!android_path || chdir(android_path) != 0) {
+		showInitError(std::string("Unable to switch into ") + std::string((android_path ? android_path : "NULL")));
+		return 0;
+	}
+#endif
+
 	/* now we load the config */
 	Config conf;
 	conf.read(argc, argv);