blob: f3b3f988458848f4062864ee995ca61cb38126e8 [file] [log] [blame]
license.botf003cfe2008-08-24 09:55:55 +09001// 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.commit3f4a7322008-07-27 06:49:38 +09004
5#include "base/base_paths.h"
6
initial.commit3f4a7322008-07-27 06:49:38 +09007#include "base/file_util.h"
8#include "base/path_service.h"
9
initial.commit3f4a7322008-07-27 06:49:38 +090010namespace base {
11
12bool PathProvider(int key, std::wstring* result) {
13 // NOTE: DIR_CURRENT is a special cased in PathService::Get
14
initial.commit3f4a7322008-07-27 06:49:38 +090015 std::wstring cur;
16 switch (key) {
initial.commit3f4a7322008-07-27 06:49:38 +090017 case base::DIR_EXE:
erikkay@google.comc7980ee2008-08-06 04:46:31 +090018 PathService::Get(base::FILE_EXE, &cur);
initial.commit3f4a7322008-07-27 06:49:38 +090019 file_util::TrimFilename(&cur);
20 break;
21 case base::DIR_MODULE:
erikkay@google.comc7980ee2008-08-06 04:46:31 +090022 PathService::Get(base::FILE_MODULE, &cur);
initial.commit3f4a7322008-07-27 06:49:38 +090023 file_util::TrimFilename(&cur);
24 break;
25 case base::DIR_TEMP:
26 if (!file_util::GetTempDir(&cur))
27 return false;
28 break;
initial.commit3f4a7322008-07-27 06:49:38 +090029 default:
30 return false;
31 }
32
33 result->swap(cur);
34 return true;
35}
36
37} // namespace base
license.botf003cfe2008-08-24 09:55:55 +090038