summaryrefslogtreecommitdiffstats
path: root/base/file_util_posix.cc
diff options
context:
space:
mode:
authormichaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 22:34:50 +0000
committermichaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 22:34:50 +0000
commitf7d6997f6253e4c7645859757bc824c4164a9a7e (patch)
tree3183103533b527bb8b436aed5412b7bf00207e94 /base/file_util_posix.cc
parent559c4e3eee40f9f3a127ba792a2ef0bcd217b543 (diff)
downloadchromium_src-f7d6997f6253e4c7645859757bc824c4164a9a7e.zip
chromium_src-f7d6997f6253e4c7645859757bc824c4164a9a7e.tar.gz
chromium_src-f7d6997f6253e4c7645859757bc824c4164a9a7e.tar.bz2
Upstream android file related code.
Implemented file related features BUG=None TEST=None Review URL: http://codereview.chromium.org/7184032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89914 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r--base/file_util_posix.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 89487d4..2e7c91e 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -25,7 +25,7 @@
#if defined(OS_MACOSX)
#include <AvailabilityMacros.h>
#include "base/mac/foundation_util.h"
-#else
+#elif !defined(OS_ANDROID)
#include <glib.h>
#endif
@@ -44,6 +44,10 @@
#include "base/time.h"
#include "base/utf_string_conversions.h"
+#if defined(OS_ANDROID)
+#include "base/os_compat_android.h"
+#endif
+
namespace file_util {
namespace {
@@ -106,7 +110,7 @@ int CountFilesCreatedAfter(const FilePath& path,
DIR* dir = opendir(path.value().c_str());
if (dir) {
#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
- !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
+ !defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_ANDROID)
#error Port warning: depending on the definition of struct dirent, \
additional space for pathname may be needed
#endif
@@ -739,7 +743,7 @@ bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
return false;
#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
- !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
+ !defined(OS_OPENBSD) && !defined(OS_SOLARIS) && !defined(OS_ANDROID)
#error Port warning: depending on the definition of struct dirent, \
additional space for pathname may be needed
#endif
@@ -839,26 +843,36 @@ bool GetTempDir(FilePath* path) {
if (tmp)
*path = FilePath(tmp);
else
+#if defined(OS_ANDROID)
+ *path = FilePath("/data/local/tmp");
+#else
*path = FilePath("/tmp");
+#endif
return true;
}
+#if !defined(OS_ANDROID)
bool GetShmemTempDir(FilePath* path) {
*path = FilePath("/dev/shm");
return true;
}
+#endif
FilePath GetHomeDir() {
const char* home_dir = getenv("HOME");
if (home_dir && home_dir[0])
return FilePath(home_dir);
+#if defined(OS_ANDROID)
+ LOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented.";
+#else
// g_get_home_dir calls getpwent, which can fall through to LDAP calls.
base::ThreadRestrictions::AssertIOAllowed();
home_dir = g_get_home_dir();
if (home_dir && home_dir[0])
return FilePath(home_dir);
+#endif
FilePath rv;
if (file_util::GetTempDir(&rv))