michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/base_paths.h" michael@0: michael@0: #include "base/file_path.h" michael@0: #include "base/file_util.h" michael@0: #include "base/path_service.h" michael@0: michael@0: namespace base { michael@0: michael@0: bool PathProvider(int key, FilePath* result) { michael@0: // NOTE: DIR_CURRENT is a special cased in PathService::Get michael@0: michael@0: FilePath cur; michael@0: switch (key) { michael@0: case base::DIR_EXE: michael@0: PathService::Get(base::FILE_EXE, &cur); michael@0: cur = cur.DirName(); michael@0: break; michael@0: case base::DIR_MODULE: michael@0: PathService::Get(base::FILE_MODULE, &cur); michael@0: cur = cur.DirName(); michael@0: break; michael@0: case base::DIR_TEMP: michael@0: if (!file_util::GetTempDir(&cur)) michael@0: return false; michael@0: break; michael@0: default: michael@0: return false; michael@0: } michael@0: michael@0: *result = cur; michael@0: return true; michael@0: } michael@0: michael@0: } // namespace base