| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/base_paths_mac.h" | 5 #include "base/base_paths_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 | 15 |
| 16 bool PathProviderMac(int key, std::wstring* result) { | 16 bool PathProviderMac(int key, FilePath* result) { |
| 17 std::wstring cur; | 17 std::wstring cur; |
| 18 switch (key) { | 18 switch (key) { |
| 19 case base::FILE_EXE: | 19 case base::FILE_EXE: |
| 20 case base::FILE_MODULE: { | 20 case base::FILE_MODULE: { |
| 21 NSString* path = [[NSBundle mainBundle] executablePath]; | 21 NSString* path = [[NSBundle mainBundle] executablePath]; |
| 22 cur = reinterpret_cast<const wchar_t*>( | 22 cur = reinterpret_cast<const wchar_t*>( |
| 23 [path cStringUsingEncoding:NSUTF32StringEncoding]); | 23 [path cStringUsingEncoding:NSUTF32StringEncoding]); |
| 24 break; | 24 break; |
| 25 } | 25 } |
| 26 case base::DIR_APP_DATA: | 26 case base::DIR_APP_DATA: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 42 // On the mac, unit tests execute two levels deep from the source root. | 42 // On the mac, unit tests execute two levels deep from the source root. |
| 43 // For example: src/xcodebuild/{Debug|Release}/base_unittests | 43 // For example: src/xcodebuild/{Debug|Release}/base_unittests |
| 44 PathService::Get(base::DIR_EXE, &cur); | 44 PathService::Get(base::DIR_EXE, &cur); |
| 45 file_util::UpOneDirectory(&cur); | 45 file_util::UpOneDirectory(&cur); |
| 46 file_util::UpOneDirectory(&cur); | 46 file_util::UpOneDirectory(&cur); |
| 47 break; | 47 break; |
| 48 default: | 48 default: |
| 49 return false; | 49 return false; |
| 50 } | 50 } |
| 51 | 51 |
| 52 result->swap(cur); | 52 *result = FilePath::FromWStringHack(cur); |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace base | 56 } // namespace base |
| OLD | NEW |