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 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 7 | #include "base/file_util.h" |
| 8 | #include "base/path_service.h" |
| 9 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 10 | namespace base { |
| 11 | |
| 12 | bool PathProvider(int key, std::wstring* result) { |
| 13 | // NOTE: DIR_CURRENT is a special cased in PathService::Get |
| 14 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 15 | std::wstring cur; |
| 16 | switch (key) { |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 17 | case base::DIR_EXE: |
erikkay@google.com | c7980ee | 2008-08-06 04:46:31 +0900 | [diff] [blame] | 18 | PathService::Get(base::FILE_EXE, &cur); |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 19 | file_util::TrimFilename(&cur); |
| 20 | break; |
| 21 | case base::DIR_MODULE: |
erikkay@google.com | c7980ee | 2008-08-06 04:46:31 +0900 | [diff] [blame] | 22 | PathService::Get(base::FILE_MODULE, &cur); |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 23 | file_util::TrimFilename(&cur); |
| 24 | break; |
| 25 | case base::DIR_TEMP: |
| 26 | if (!file_util::GetTempDir(&cur)) |
| 27 | return false; |
| 28 | break; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 29 | default: |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | result->swap(cur); |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | } // namespace base |
license.bot | f003cfe | 2008-08-24 09:55:55 +0900 | [diff] [blame^] | 38 | |