| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <libgen.h> | 10 #include <libgen.h> |
| 11 #include <limits.h> | 11 #include <limits.h> |
| 12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 #include <string.h> | 14 #include <string.h> |
| 15 #include <sys/errno.h> | 15 #include <sys/errno.h> |
| 16 #include <sys/mman.h> | 16 #include <sys/mman.h> |
| 17 #include <sys/param.h> | 17 #include <sys/param.h> |
| 18 #include <sys/stat.h> | 18 #include <sys/stat.h> |
| 19 #include <sys/time.h> | 19 #include <sys/time.h> |
| 20 #include <sys/types.h> | 20 #include <sys/types.h> |
| 21 #include <time.h> | 21 #include <time.h> |
| 22 #include <unistd.h> | 22 #include <unistd.h> |
| 23 | 23 |
| 24 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
| 25 #include <AvailabilityMacros.h> | 25 #include <AvailabilityMacros.h> |
| 26 #include "base/mac/foundation_util.h" | 26 #include "base/mac/foundation_util.h" |
| 27 #elif !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 27 #elif !defined(OS_CHROMEOS) && defined(USE_GLIB) |
| 28 #include <glib.h> // for g_get_home_dir() | 28 #include <glib.h> // for g_get_home_dir() |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #include <fstream> | 31 #include <fstream> |
| 32 | 32 |
| 33 #include "base/basictypes.h" | 33 #include "base/basictypes.h" |
| 34 #include "base/files/file_enumerator.h" | 34 #include "base/files/file_enumerator.h" |
| 35 #include "base/files/file_path.h" | 35 #include "base/files/file_path.h" |
| 36 #include "base/logging.h" | 36 #include "base/logging.h" |
| 37 #include "base/memory/scoped_ptr.h" | 37 #include "base/memory/scoped_ptr.h" |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 if (base::SysInfo::IsRunningOnChromeOS()) | 771 if (base::SysInfo::IsRunningOnChromeOS()) |
| 772 return FilePath("/home/chronos/user"); | 772 return FilePath("/home/chronos/user"); |
| 773 #endif | 773 #endif |
| 774 | 774 |
| 775 const char* home_dir = getenv("HOME"); | 775 const char* home_dir = getenv("HOME"); |
| 776 if (home_dir && home_dir[0]) | 776 if (home_dir && home_dir[0]) |
| 777 return FilePath(home_dir); | 777 return FilePath(home_dir); |
| 778 | 778 |
| 779 #if defined(OS_ANDROID) | 779 #if defined(OS_ANDROID) |
| 780 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; | 780 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; |
| 781 #elif !defined(OS_CHROMEOS) | 781 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS) |
| 782 // g_get_home_dir calls getpwent, which can fall through to LDAP calls. | 782 // g_get_home_dir calls getpwent, which can fall through to LDAP calls. |
| 783 base::ThreadRestrictions::AssertIOAllowed(); | 783 base::ThreadRestrictions::AssertIOAllowed(); |
| 784 | 784 |
| 785 home_dir = g_get_home_dir(); | 785 home_dir = g_get_home_dir(); |
| 786 if (home_dir && home_dir[0]) | 786 if (home_dir && home_dir[0]) |
| 787 return FilePath(home_dir); | 787 return FilePath(home_dir); |
| 788 #endif | 788 #endif |
| 789 | 789 |
| 790 FilePath rv; | 790 FilePath rv; |
| 791 if (file_util::GetTempDir(&rv)) | 791 if (file_util::GetTempDir(&rv)) |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 result = false; | 946 result = false; |
| 947 if (HANDLE_EINTR(close(outfile)) < 0) | 947 if (HANDLE_EINTR(close(outfile)) < 0) |
| 948 result = false; | 948 result = false; |
| 949 | 949 |
| 950 return result; | 950 return result; |
| 951 } | 951 } |
| 952 #endif // !defined(OS_MACOSX) | 952 #endif // !defined(OS_MACOSX) |
| 953 | 953 |
| 954 } // namespace internal | 954 } // namespace internal |
| 955 } // namespace base | 955 } // namespace base |
| OLD | NEW |