1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/chromium/src/base/base_paths.cc Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#include "base/base_paths.h" 1.9 + 1.10 +#include "base/file_path.h" 1.11 +#include "base/file_util.h" 1.12 +#include "base/path_service.h" 1.13 + 1.14 +namespace base { 1.15 + 1.16 +bool PathProvider(int key, FilePath* result) { 1.17 + // NOTE: DIR_CURRENT is a special cased in PathService::Get 1.18 + 1.19 + FilePath cur; 1.20 + switch (key) { 1.21 + case base::DIR_EXE: 1.22 + PathService::Get(base::FILE_EXE, &cur); 1.23 + cur = cur.DirName(); 1.24 + break; 1.25 + case base::DIR_MODULE: 1.26 + PathService::Get(base::FILE_MODULE, &cur); 1.27 + cur = cur.DirName(); 1.28 + break; 1.29 + case base::DIR_TEMP: 1.30 + if (!file_util::GetTempDir(&cur)) 1.31 + return false; 1.32 + break; 1.33 + default: 1.34 + return false; 1.35 + } 1.36 + 1.37 + *result = cur; 1.38 + return true; 1.39 +} 1.40 + 1.41 +} // namespace base