OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/foundation_util.h" | 5 #include "base/mac/foundation_util.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 // Adapted from http://developer.apple.com/carbon/tipsandtricks.html#AmIBundled | 29 // Adapted from http://developer.apple.com/carbon/tipsandtricks.html#AmIBundled |
30 static bool UncachedAmIBundled() { | 30 static bool UncachedAmIBundled() { |
31 #if defined(OS_IOS) | 31 #if defined(OS_IOS) |
32 // All apps are bundled on iOS. | 32 // All apps are bundled on iOS. |
33 return true; | 33 return true; |
34 #else | 34 #else |
35 if (g_override_am_i_bundled) | 35 if (g_override_am_i_bundled) |
36 return g_override_am_i_bundled_value; | 36 return g_override_am_i_bundled_value; |
37 | 37 |
38 NSBundle* bundle = base::mac::OuterBundle(); | 38 NSBundle* bundle = base::mac::OuterBundle(); |
39 NSArray* bundle_parts = [[bundle bundlePath] pathComponents]; | 39 NSArray* bundle_parts = |
40 NSArray* executable_parts = [[bundle executablePath] pathComponents]; | 40 [[[bundle bundlePath] stringByStandardizingPath] pathComponents]; |
Mark Mentovai
2013/10/25 22:54:56
This isn’t really correct. The tilde expansion it
| |
41 NSArray* executable_parts = | |
42 [[[bundle executablePath] stringByStandardizingPath] pathComponents]; | |
41 | 43 |
42 // Bundled executables are exactly three levels deeper than their bundle. | 44 // Bundled executables are exactly three levels deeper than their bundle. |
43 // Non-bundled executables have a fake bundle with a bundle path of their | 45 // Non-bundled executables have a fake bundle with a bundle path of their |
44 // parent directory. | 46 // parent directory. |
45 NSUInteger depth_difference = [executable_parts count] - [bundle_parts count]; | 47 NSUInteger depth_difference = [executable_parts count] - [bundle_parts count]; |
46 CHECK(depth_difference == 1 || depth_difference == 3); | 48 CHECK(depth_difference == 1 || depth_difference == 3); |
47 return depth_difference == 3; | 49 return depth_difference == 3; |
48 #endif | 50 #endif |
49 } | 51 } |
50 | 52 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 CFDictionaryGetValue(user_info.get(), kCFErrorDescriptionKey)); | 385 CFDictionaryGetValue(user_info.get(), kCFErrorDescriptionKey)); |
384 } | 386 } |
385 o << "Code: " << CFErrorGetCode(err) | 387 o << "Code: " << CFErrorGetCode(err) |
386 << " Domain: " << CFErrorGetDomain(err) | 388 << " Domain: " << CFErrorGetDomain(err) |
387 << " Desc: " << desc.get(); | 389 << " Desc: " << desc.get(); |
388 if(errorDesc) { | 390 if(errorDesc) { |
389 o << "(" << errorDesc << ")"; | 391 o << "(" << errorDesc << ")"; |
390 } | 392 } |
391 return o; | 393 return o; |
392 } | 394 } |
OLD | NEW |