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