| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/chrome_paths_internal.h" | 5 #include "chrome/common/chrome_paths_internal.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | |
| 8 #include <glib.h> | 7 #include <glib.h> |
| 9 #endif | |
| 10 #include <stdlib.h> | 8 #include <stdlib.h> |
| 11 | 9 |
| 12 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 13 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 14 #include "chrome/third_party/xdg_user_dirs/xdg_user_dir_lookup.h" | 12 #include "chrome/third_party/xdg_user_dirs/xdg_user_dir_lookup.h" |
| 15 | 13 |
| 16 namespace { | 14 namespace { |
| 17 | 15 |
| 18 FilePath GetHomeDir() { | 16 FilePath GetHomeDir() { |
| 19 const char *home_dir = getenv("HOME"); | 17 const char *home_dir = getenv("HOME"); |
| 20 | 18 |
| 21 if (home_dir && home_dir[0]) | 19 if (home_dir && home_dir[0]) |
| 22 return FilePath(home_dir); | 20 return FilePath(home_dir); |
| 23 | 21 |
| 24 #if defined(TOOLKIT_GTK) | |
| 25 home_dir = g_get_home_dir(); | 22 home_dir = g_get_home_dir(); |
| 26 if (home_dir && home_dir[0]) | 23 if (home_dir && home_dir[0]) |
| 27 return FilePath(home_dir); | 24 return FilePath(home_dir); |
| 28 #endif | |
| 29 | 25 |
| 30 FilePath rv; | 26 FilePath rv; |
| 31 if (PathService::Get(base::DIR_TEMP, &rv)) | 27 if (PathService::Get(base::DIR_TEMP, &rv)) |
| 32 return rv; | 28 return rv; |
| 33 | 29 |
| 34 /* last resort */ | 30 /* last resort */ |
| 35 return FilePath("/tmp/"); | 31 return FilePath("/tmp/"); |
| 36 } | 32 } |
| 37 | 33 |
| 38 // Wrapper around xdg_user_dir_lookup() from | 34 // Wrapper around xdg_user_dir_lookup() from |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 96 |
| 101 return true; | 97 return true; |
| 102 } | 98 } |
| 103 | 99 |
| 104 bool GetUserDesktop(FilePath* result) { | 100 bool GetUserDesktop(FilePath* result) { |
| 105 *result = GetXDGUserDirectory("DESKTOP", "Desktop"); | 101 *result = GetXDGUserDirectory("DESKTOP", "Desktop"); |
| 106 return true; | 102 return true; |
| 107 } | 103 } |
| 108 | 104 |
| 109 } // namespace chrome | 105 } // namespace chrome |
| OLD | NEW |