license.bot | bf09a50 | 2008-08-24 00:55:55 | [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 | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 4 | |
5 | #include "base/base_paths.h" | ||||
6 | |||||
[email protected] | 640517f | 2008-10-30 23:54:04 | [diff] [blame] | 7 | #include "base/file_path.h" |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 8 | #include "base/file_util.h" |
9 | #include "base/path_service.h" | ||||
10 | |||||
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 11 | namespace base { |
12 | |||||
[email protected] | 4792a26 | 2008-11-19 16:50:03 | [diff] [blame] | 13 | bool PathProvider(int key, FilePath* result) { |
[email protected] | dea1d7d | 2012-09-20 16:24:52 | [diff] [blame^] | 14 | // NOTE: DIR_CURRENT is a special case in PathService::Get |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 15 | |
[email protected] | 640517f | 2008-10-30 23:54:04 | [diff] [blame] | 16 | FilePath cur; |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 17 | switch (key) { |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 18 | case base::DIR_EXE: |
[email protected] | ac510e1 | 2008-08-05 19:46:31 | [diff] [blame] | 19 | PathService::Get(base::FILE_EXE, &cur); |
[email protected] | 640517f | 2008-10-30 23:54:04 | [diff] [blame] | 20 | cur = cur.DirName(); |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 21 | break; |
22 | case base::DIR_MODULE: | ||||
[email protected] | ac510e1 | 2008-08-05 19:46:31 | [diff] [blame] | 23 | PathService::Get(base::FILE_MODULE, &cur); |
[email protected] | 640517f | 2008-10-30 23:54:04 | [diff] [blame] | 24 | cur = cur.DirName(); |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 25 | break; |
26 | case base::DIR_TEMP: | ||||
27 | if (!file_util::GetTempDir(&cur)) | ||||
28 | return false; | ||||
29 | break; | ||||
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 30 | default: |
31 | return false; | ||||
32 | } | ||||
33 | |||||
[email protected] | 4792a26 | 2008-11-19 16:50:03 | [diff] [blame] | 34 | *result = cur; |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 35 | return true; |
36 | } | ||||
37 | |||||
38 | } // namespace base |