| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // On Chrome OS chrome::DIR_USER_DATA is overridden with a primary user |
| 463 // homedir once it becomes available. | 463 // homedir once it becomes available. Return / as the safe option. |
| 464 NOTREACHED() << "Called GetHomeDir() without base::DIR_HOME override"; | |
| 465 return FilePath("/"); | 464 return FilePath("/"); |
| 466 } | 465 } |
| 467 #endif | 466 #endif |
| 468 | 467 |
| 469 const char* home_dir = getenv("HOME"); | 468 const char* home_dir = getenv("HOME"); |
| 470 if (home_dir && home_dir[0]) | 469 if (home_dir && home_dir[0]) |
| 471 return FilePath(home_dir); | 470 return FilePath(home_dir); |
| 472 | 471 |
| 473 #if defined(OS_ANDROID) | 472 #if defined(OS_ANDROID) |
| 474 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; | 473 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 result = false; | 893 result = false; |
| 895 if (IGNORE_EINTR(close(outfile)) < 0) | 894 if (IGNORE_EINTR(close(outfile)) < 0) |
| 896 result = false; | 895 result = false; |
| 897 | 896 |
| 898 return result; | 897 return result; |
| 899 } | 898 } |
| 900 #endif // !defined(OS_MACOSX) | 899 #endif // !defined(OS_MACOSX) |
| 901 | 900 |
| 902 } // namespace internal | 901 } // namespace internal |
| 903 } // namespace base | 902 } // namespace base |
| OLD | NEW |