OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/common/chrome_paths.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 cur = cur.Append(FILE_PATH_LITERAL("Extensions")); | 346 cur = cur.Append(FILE_PATH_LITERAL("Extensions")); |
347 create_dir = false; | 347 create_dir = false; |
348 #else | 348 #else |
349 if (!PathService::Get(base::DIR_MODULE, &cur)) | 349 if (!PathService::Get(base::DIR_MODULE, &cur)) |
350 return false; | 350 return false; |
351 | 351 |
352 cur = cur.Append(FILE_PATH_LITERAL("extensions")); | 352 cur = cur.Append(FILE_PATH_LITERAL("extensions")); |
353 create_dir = true; | 353 create_dir = true; |
354 #endif | 354 #endif |
355 break; | 355 break; |
| 356 case chrome::DIR_DEFAULT_APPS: |
| 357 #if defined(OS_MACOSX) |
| 358 cur = base::mac::MainAppBundlePath(); |
| 359 cur = cur.Append(FILE_PATH_LITERAL("Default Apps")); |
| 360 #else |
| 361 if (!PathService::Get(chrome::DIR_APP, &cur)) |
| 362 return false; |
| 363 cur = cur.Append(FILE_PATH_LITERAL("default_apps")); |
| 364 #endif |
| 365 break; |
356 default: | 366 default: |
357 return false; | 367 return false; |
358 } | 368 } |
359 | 369 |
360 if (create_dir && !file_util::PathExists(cur) && | 370 if (create_dir && !file_util::PathExists(cur) && |
361 !file_util::CreateDirectory(cur)) | 371 !file_util::CreateDirectory(cur)) |
362 return false; | 372 return false; |
363 | 373 |
364 *result = cur; | 374 *result = cur; |
365 return true; | 375 return true; |
366 } | 376 } |
367 | 377 |
368 // This cannot be done as a static initializer sadly since Visual Studio will | 378 // This cannot be done as a static initializer sadly since Visual Studio will |
369 // eliminate this object file if there is no direct entry point into it. | 379 // eliminate this object file if there is no direct entry point into it. |
370 void RegisterPathProvider() { | 380 void RegisterPathProvider() { |
371 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 381 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
372 } | 382 } |
373 | 383 |
374 } // namespace chrome | 384 } // namespace chrome |
OLD | NEW |