Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3872)

Unified Diff: base/file_util_posix.cc

Issue 7184032: Upstream android file related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove android specific shmem method Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 89487d4dc4c4d0af594ab57e9bd74d3f8ee55317..2e7c91e14f023ad7ff21117f53e1f885c900e35e 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))
« no previous file with comments | « base/file_util_android.cc ('k') | base/os_compat_android.h » ('j') | base/shared_memory_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698