license.bot | f003cfe | 2008-08-24 09:55:55 +0900 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 4 | |
| 5 | #include "base/base_paths.h" |
| 6 | |
evanm@google.com | 874d167 | 2008-10-31 08:54:04 +0900 | [diff] [blame] | 7 | #include "base/file_path.h" |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 8 | #include "base/file_util.h" |
| 9 | #include "base/path_service.h" |
| 10 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 11 | namespace base { |
| 12 | |
evanm@google.com | 3e9d5d7 | 2008-11-20 01:50:03 +0900 | [diff] [blame] | 13 | bool PathProvider(int key, FilePath* result) { |
gab@chromium.org | 97fc1e6 | 2012-09-21 01:24:52 +0900 | [diff] [blame^] | 14 | // NOTE: DIR_CURRENT is a special case in PathService::Get |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 15 | |
evanm@google.com | 874d167 | 2008-10-31 08:54:04 +0900 | [diff] [blame] | 16 | FilePath cur; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 17 | switch (key) { |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 18 | case base::DIR_EXE: |
erikkay@google.com | c7980ee | 2008-08-06 04:46:31 +0900 | [diff] [blame] | 19 | PathService::Get(base::FILE_EXE, &cur); |
evanm@google.com | 874d167 | 2008-10-31 08:54:04 +0900 | [diff] [blame] | 20 | cur = cur.DirName(); |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 21 | break; |
| 22 | case base::DIR_MODULE: |
erikkay@google.com | c7980ee | 2008-08-06 04:46:31 +0900 | [diff] [blame] | 23 | PathService::Get(base::FILE_MODULE, &cur); |
evanm@google.com | 874d167 | 2008-10-31 08:54:04 +0900 | [diff] [blame] | 24 | cur = cur.DirName(); |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 25 | break; |
| 26 | case base::DIR_TEMP: |
| 27 | if (!file_util::GetTempDir(&cur)) |
| 28 | return false; |
| 29 | break; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 30 | default: |
| 31 | return false; |
| 32 | } |
| 33 | |
evanm@google.com | 3e9d5d7 | 2008-11-20 01:50:03 +0900 | [diff] [blame] | 34 | *result = cur; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 35 | return true; |
| 36 | } |
| 37 | |
| 38 | } // namespace base |