Chromium Code Reviews| Index: base/file_util_posix.cc |
| diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc |
| index 89487d4dc4c4d0af594ab57e9bd74d3f8ee55317..1902ca26e6b88a8197873d0b059834c763efe023 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 |
| @@ -35,6 +35,9 @@ |
| #include "base/eintr_wrapper.h" |
| #include "base/file_path.h" |
| #include "base/logging.h" |
| +#if defined(OS_ANDROID) |
|
brettw
2011/06/17 16:29:14
Can you put this below all other includes with a b
michaelbai
2011/06/17 22:41:29
Done.
|
| +#include "base/platform_file.h" |
|
darin (slow to review)
2011/06/17 16:29:29
nit: this include looks unnecessary.
michaelbai
2011/06/17 22:41:29
Removed, but still need 'base/platform_file_androi
|
| +#endif |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/singleton.h" |
| #include "base/string_util.h" |
| @@ -106,7 +109,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 +742,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,12 +842,20 @@ 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; |
| } |
| bool GetShmemTempDir(FilePath* path) { |
| +#if defined(OS_ANDROID) |
| + *path = FilePath("/data/local/tmp"); |
| +#else |
| *path = FilePath("/dev/shm"); |
| +#endif |
| return true; |
| } |
| @@ -853,12 +864,16 @@ FilePath GetHomeDir() { |
| 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)) |