blob: 80105b6e17594af637b280c0cbe17d6719803607 [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
evanm@google.com3e9d5d72008-11-20 01:50:03 +090013bool PathProvider(int key, FilePath* result) {
gab@chromium.org97fc1e62012-09-21 01:24:52 +090014 // NOTE: DIR_CURRENT is a special case in PathService::Get
initial.commit3f4a7322008-07-27 06:49:38 +090015
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.com3e9d5d72008-11-20 01:50:03 +090034 *result = cur;
initial.commit3f4a7322008-07-27 06:49:38 +090035 return true;
36}
37
38} // namespace base