Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: base/file_util_posix.cc

Issue 200473002: Move all callers of GetHomeDir() to PathService::Get(base::DIR_HOME). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util.h ('k') | base/nix/xdg_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 return FilePath("/home/chronos/user"); 462 // On Chrome OS chrome::DIR_USER_DATA is overriden with a primary user
463 // homedir once it becomes available.
464 NOTREACHED() << "Called GetHomeDir() without base::DIR_HOME override";
465 return FilePath("/");
466 }
463 #endif 467 #endif
464 468
465 const char* home_dir = getenv("HOME"); 469 const char* home_dir = getenv("HOME");
466 if (home_dir && home_dir[0]) 470 if (home_dir && home_dir[0])
467 return FilePath(home_dir); 471 return FilePath(home_dir);
468 472
469 #if defined(OS_ANDROID) 473 #if defined(OS_ANDROID)
470 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; 474 DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented.";
471 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS) 475 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS)
472 // g_get_home_dir calls getpwent, which can fall through to LDAP calls so 476 // 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
890 result = false; 894 result = false;
891 if (IGNORE_EINTR(close(outfile)) < 0) 895 if (IGNORE_EINTR(close(outfile)) < 0)
892 result = false; 896 result = false;
893 897
894 return result; 898 return result;
895 } 899 }
896 #endif // !defined(OS_MACOSX) 900 #endif // !defined(OS_MACOSX)
897 901
898 } // namespace internal 902 } // namespace internal
899 } // namespace base 903 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | base/nix/xdg_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698