summaryrefslogtreecommitdiff
path: root/src/filesys.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-04-21 14:10:59 +0200
committersapier <Sapier at GMX dot net>2014-06-29 18:17:56 +0200
commit1cc40c0a7c260f0562572bc99f39a666a12f1b09 (patch)
treec5af6b9787f4c69faa634e82f6484ca4540a7f88 /src/filesys.cpp
parentff36071d93266c1dd18708f8924d80aa1af5b33e (diff)
downloadminetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.tar.gz
minetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.tar.bz2
minetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.zip
Add support for Android 2.3+
There have been plenty of ppl involved in creating this version. I don't wanna mention names as I'm sure I'd forget someone so I just tell where help has been done: - The partial android versions done by various ppl - Testing on different android devices - reviewing code (especially the in core changes) - testing controls - reviewing texts A big thank you to everyone helping this to be completed!
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r--src/filesys.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp
index eda36c833..7c72a4b27 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <errno.h>
#include <fstream>
#include "log.h"
+#include "config.h"
namespace fs
{
@@ -34,8 +35,8 @@ namespace fs
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <malloc.h>
-#include <tchar.h>
-#include <wchar.h>
+#include <tchar.h>
+#include <wchar.h>
#define BUFSIZE MAX_PATH
@@ -73,12 +74,12 @@ std::vector<DirListNode> GetDirListing(std::string pathstring)
// Find the first file in the directory.
hFind = FindFirstFile(DirSpec, &FindFileData);
- if (hFind == INVALID_HANDLE_VALUE)
+ if (hFind == INVALID_HANDLE_VALUE)
{
retval = (-1);
goto Cleanup;
- }
- else
+ }
+ else
{
// NOTE:
// Be very sure to not include '..' in the results, it will
@@ -91,7 +92,7 @@ std::vector<DirListNode> GetDirListing(std::string pathstring)
listing.push_back(node);
// List all the other files in the directory.
- while (FindNextFile(hFind, &FindFileData) != 0)
+ while (FindNextFile(hFind, &FindFileData) != 0)
{
DirListNode node;
node.name = FindFileData.cFileName;
@@ -102,7 +103,7 @@ std::vector<DirListNode> GetDirListing(std::string pathstring)
dwError = GetLastError();
FindClose(hFind);
- if (dwError != ERROR_NO_MORE_FILES)
+ if (dwError != ERROR_NO_MORE_FILES)
{
errorstream<<"GetDirListing: FindNextFile error. Error is "
<<dwError<<std::endl;
@@ -401,7 +402,11 @@ std::string TempPath()
compatible with lua's os.tmpname which under the default
configuration hardcodes mkstemp("/tmp/lua_XXXXXX").
*/
- return std::string(DIR_DELIM) + "tmp";
+#ifdef __ANDROID__
+ return DIR_DELIM "sdcard" DIR_DELIM PROJECT_NAME DIR_DELIM "tmp";
+#else
+ return DIR_DELIM "tmp";
+#endif
}
#endif