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

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: . Created 6 years, 9 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 | « no previous file | base/nix/mime_util_xdg.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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
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");
Dmitry Polukhin 2014/03/17 18:28:30 I think it is bad idea to use /tmp attacker could
Will Drewry 2014/04/08 15:55:04 '/' is definitely a better choice since it isn't w
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
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
OLDNEW
« no previous file with comments | « no previous file | base/nix/mime_util_xdg.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698