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..16d33eb2ba2b34cfaddd66158fed4ba6251eb503 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/file_util_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 // !defined(OS_ANDROID) |
|
darin (slow to review)
2011/06/20 18:44:01
no need for the comment here. the #if block is so
michaelbai
2011/06/20 22:50:36
Done.
|
| 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)) |