blob: 80105b6e17594af637b280c0cbe17d6719803607 [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// 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.commitd7cae122008-07-26 21:49:384
5#include "base/base_paths.h"
6
[email protected]640517f2008-10-30 23:54:047#include "base/file_path.h"
initial.commitd7cae122008-07-26 21:49:388#include "base/file_util.h"
9#include "base/path_service.h"
10
initial.commitd7cae122008-07-26 21:49:3811namespace base {
12
[email protected]4792a262008-11-19 16:50:0313bool PathProvider(int key, FilePath* result) {
[email protected]dea1d7d2012-09-20 16:24:5214 // NOTE: DIR_CURRENT is a special case in PathService::Get
initial.commitd7cae122008-07-26 21:49:3815
[email protected]640517f2008-10-30 23:54:0416 FilePath cur;
initial.commitd7cae122008-07-26 21:49:3817 switch (key) {
initial.commitd7cae122008-07-26 21:49:3818 case base::DIR_EXE:
[email protected]ac510e12008-08-05 19:46:3119 PathService::Get(base::FILE_EXE, &cur);
[email protected]640517f2008-10-30 23:54:0420 cur = cur.DirName();
initial.commitd7cae122008-07-26 21:49:3821 break;
22 case base::DIR_MODULE:
[email protected]ac510e12008-08-05 19:46:3123 PathService::Get(base::FILE_MODULE, &cur);
[email protected]640517f2008-10-30 23:54:0424 cur = cur.DirName();
initial.commitd7cae122008-07-26 21:49:3825 break;
26 case base::DIR_TEMP:
27 if (!file_util::GetTempDir(&cur))
28 return false;
29 break;
initial.commitd7cae122008-07-26 21:49:3830 default:
31 return false;
32 }
33
[email protected]4792a262008-11-19 16:50:0334 *result = cur;
initial.commitd7cae122008-07-26 21:49:3835 return true;
36}
37
38} // namespace base