Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #include "base/base_paths.h" |
michael@0 | 6 | |
michael@0 | 7 | #include "base/file_path.h" |
michael@0 | 8 | #include "base/file_util.h" |
michael@0 | 9 | #include "base/path_service.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace base { |
michael@0 | 12 | |
michael@0 | 13 | bool PathProvider(int key, FilePath* result) { |
michael@0 | 14 | // NOTE: DIR_CURRENT is a special cased in PathService::Get |
michael@0 | 15 | |
michael@0 | 16 | FilePath cur; |
michael@0 | 17 | switch (key) { |
michael@0 | 18 | case base::DIR_EXE: |
michael@0 | 19 | PathService::Get(base::FILE_EXE, &cur); |
michael@0 | 20 | cur = cur.DirName(); |
michael@0 | 21 | break; |
michael@0 | 22 | case base::DIR_MODULE: |
michael@0 | 23 | PathService::Get(base::FILE_MODULE, &cur); |
michael@0 | 24 | cur = cur.DirName(); |
michael@0 | 25 | break; |
michael@0 | 26 | case base::DIR_TEMP: |
michael@0 | 27 | if (!file_util::GetTempDir(&cur)) |
michael@0 | 28 | return false; |
michael@0 | 29 | break; |
michael@0 | 30 | default: |
michael@0 | 31 | return false; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | *result = cur; |
michael@0 | 35 | return true; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | } // namespace base |