| 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> |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return true; | 477 return true; |
| 478 } | 478 } |
| 479 #endif | 479 #endif |
| 480 return GetTempDir(path); | 480 return GetTempDir(path); |
| 481 } | 481 } |
| 482 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) | 482 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 483 | 483 |
| 484 #if !defined(OS_MACOSX) // Mac implementation is in file_util_mac.mm. | 484 #if !defined(OS_MACOSX) // Mac implementation is in file_util_mac.mm. |
| 485 FilePath GetHomeDir() { | 485 FilePath GetHomeDir() { |
| 486 #if defined(OS_CHROMEOS) | 486 #if defined(OS_CHROMEOS) |
| 487 if (SysInfo::IsRunningOnChromeOS()) | 487 if (SysInfo::IsRunningOnChromeOS()) { |
| 488 return FilePath("/home/chronos/user"); | 488 // On Chrome OS chrome::DIR_USER_DATA is overriden with a primary user |
| 489 // homedir once it becomes available. |
| 490 NOTREACHED() << "Called GetHomeDir() without base::DIR_HOME override"; |
| 491 return FilePath("/tmp"); |
| 492 } |
| 489 #endif | 493 #endif |
| 490 | 494 |
| 491 const char* home_dir = getenv("HOME"); | 495 const char* home_dir = getenv("HOME"); |
| 492 if (home_dir && home_dir[0]) | 496 if (home_dir && home_dir[0]) |
| 493 return FilePath(home_dir); | 497 return FilePath(home_dir); |
| 494 | 498 |
| 495 #if defined(OS_ANDROID) | 499 #if defined(OS_ANDROID) |
| 496 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; | 500 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; |
| 497 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS) | 501 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS) |
| 498 // g_get_home_dir calls getpwent, which can fall through to LDAP calls so | 502 // g_get_home_dir calls getpwent, which can fall through to LDAP calls so |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 result = false; | 925 result = false; |
| 922 if (IGNORE_EINTR(close(outfile)) < 0) | 926 if (IGNORE_EINTR(close(outfile)) < 0) |
| 923 result = false; | 927 result = false; |
| 924 | 928 |
| 925 return result; | 929 return result; |
| 926 } | 930 } |
| 927 #endif // !defined(OS_MACOSX) | 931 #endif // !defined(OS_MACOSX) |
| 928 | 932 |
| 929 } // namespace internal | 933 } // namespace internal |
| 930 } // namespace base | 934 } // namespace base |
| OLD | NEW |