Index: base/file_util_posix.cc |
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc |
index 8947d6aacf79d11275f6df32ed86c92013690b4e..2d80053a1068659f7ae3d6eb59eb28e04afa1892 100644 |
--- a/base/file_util_posix.cc |
+++ b/base/file_util_posix.cc |
@@ -21,6 +21,8 @@ |
#if defined(OS_MACOSX) |
#include <AvailabilityMacros.h> |
+#else |
+#include <glib.h> |
willchan no longer on Chromium
2010/04/22 23:01:18
What's this for?
|
#endif |
#include <fstream> |
@@ -728,6 +730,23 @@ bool GetShmemTempDir(FilePath* path) { |
return true; |
} |
+FilePath GetHomeDir() { |
+ const char* home_dir = getenv("HOME"); |
willchan no longer on Chromium
2010/04/22 23:01:18
I think you need <stdlib.h> for getenv.
|
+ if (home_dir && home_dir[0]) |
+ return FilePath(home_dir); |
+ |
+ home_dir = g_get_home_dir(); |
+ if (home_dir && home_dir[0]) |
+ return FilePath(home_dir); |
+ |
+ FilePath rv; |
+ if (file_util::GetTempDir(&rv)) |
+ return rv; |
+ |
+ // Last resort. |
+ return FilePath("/tmp"); |
+} |
+ |
bool CopyFile(const FilePath& from_path, const FilePath& to_path) { |
int infile = open(from_path.value().c_str(), O_RDONLY); |
if (infile < 0) |