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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 *path = FilePath("/tmp"); | 451 *path = FilePath("/tmp"); |
452 #endif | 452 #endif |
453 } | 453 } |
454 return true; | 454 return true; |
455 } | 455 } |
456 #endif // !defined(OS_MACOSX) | 456 #endif // !defined(OS_MACOSX) |
457 | 457 |
458 #if !defined(OS_MACOSX) // Mac implementation is in file_util_mac.mm. | 458 #if !defined(OS_MACOSX) // Mac implementation is in file_util_mac.mm. |
459 FilePath GetHomeDir() { | 459 FilePath GetHomeDir() { |
460 #if defined(OS_CHROMEOS) | 460 #if defined(OS_CHROMEOS) |
461 if (SysInfo::IsRunningOnChromeOS()) { | 461 if (SysInfo::IsRunningOnChromeOS()) |
462 // On Chrome OS chrome::DIR_USER_DATA is overriden with a primary user | 462 return FilePath("/home/chronos/user"); |
463 // homedir once it becomes available. | |
464 NOTREACHED() << "Called GetHomeDir() without base::DIR_HOME override"; | |
465 return FilePath("/"); | |
466 } | |
467 #endif | 463 #endif |
468 | 464 |
469 const char* home_dir = getenv("HOME"); | 465 const char* home_dir = getenv("HOME"); |
470 if (home_dir && home_dir[0]) | 466 if (home_dir && home_dir[0]) |
471 return FilePath(home_dir); | 467 return FilePath(home_dir); |
472 | 468 |
473 #if defined(OS_ANDROID) | 469 #if defined(OS_ANDROID) |
474 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; | 470 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; |
475 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS) | 471 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS) |
476 // g_get_home_dir calls getpwent, which can fall through to LDAP calls so | 472 // g_get_home_dir calls getpwent, which can fall through to LDAP calls so |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 result = false; | 890 result = false; |
895 if (IGNORE_EINTR(close(outfile)) < 0) | 891 if (IGNORE_EINTR(close(outfile)) < 0) |
896 result = false; | 892 result = false; |
897 | 893 |
898 return result; | 894 return result; |
899 } | 895 } |
900 #endif // !defined(OS_MACOSX) | 896 #endif // !defined(OS_MACOSX) |
901 | 897 |
902 } // namespace internal | 898 } // namespace internal |
903 } // namespace base | 899 } // namespace base |
OLD | NEW |