blob: 672bde150b83f1d4f0ded7602c5e711480e4ef46 [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
evanm@google.com874d1672008-10-31 08:54:04 +09007#include "base/file_path.h"
initial.commit3f4a7322008-07-27 06:49:38 +09008#include "base/file_util.h"
9#include "base/path_service.h"
10
initial.commit3f4a7322008-07-27 06:49:38 +090011namespace base {
12
13bool PathProvider(int key, std::wstring* result) {
14 // NOTE: DIR_CURRENT is a special cased in PathService::Get
15
evanm@google.com874d1672008-10-31 08:54:04 +090016 FilePath cur;
initial.commit3f4a7322008-07-27 06:49:38 +090017 switch (key) {
initial.commit3f4a7322008-07-27 06:49:38 +090018 case base::DIR_EXE:
erikkay@google.comc7980ee2008-08-06 04:46:31 +090019 PathService::Get(base::FILE_EXE, &cur);
evanm@google.com874d1672008-10-31 08:54:04 +090020 cur = cur.DirName();
initial.commit3f4a7322008-07-27 06:49:38 +090021 break;
22 case base::DIR_MODULE:
erikkay@google.comc7980ee2008-08-06 04:46:31 +090023 PathService::Get(base::FILE_MODULE, &cur);
evanm@google.com874d1672008-10-31 08:54:04 +090024 cur = cur.DirName();
initial.commit3f4a7322008-07-27 06:49:38 +090025 break;
26 case base::DIR_TEMP:
27 if (!file_util::GetTempDir(&cur))
28 return false;
29 break;
initial.commit3f4a7322008-07-27 06:49:38 +090030 default:
31 return false;
32 }
33
evanm@google.com874d1672008-10-31 08:54:04 +090034 *result = cur.ToWStringHack();
initial.commit3f4a7322008-07-27 06:49:38 +090035 return true;
36}
37
38} // namespace base
license.botf003cfe2008-08-24 09:55:55 +090039