| Index: base/mac/foundation_util.mm
|
| diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
|
| index 8ab02abce8e027f28678c8cd475a0be9dfbf5015..ba7eb4bad270a0918e584e17bf5da12c5ebd1fd0 100644
|
| --- a/base/mac/foundation_util.mm
|
| +++ b/base/mac/foundation_util.mm
|
| @@ -73,9 +73,7 @@ FilePath PathForFrameworkBundleResource(CFStringRef resourceName) {
|
| NSBundle* bundle = base::mac::FrameworkBundle();
|
| NSString* resourcePath = [bundle pathForResource:(NSString*)resourceName
|
| ofType:nil];
|
| - if (!resourcePath)
|
| - return FilePath();
|
| - return FilePath([resourcePath fileSystemRepresentation]);
|
| + return NSStringToFilePath(resourcePath);
|
| }
|
|
|
| OSType CreatorCodeForCFBundleRef(CFBundleRef bundle) {
|
| @@ -101,8 +99,7 @@ bool GetSearchPathDirectory(NSSearchPathDirectory directory,
|
| if ([dirs count] < 1) {
|
| return false;
|
| }
|
| - NSString* path = [dirs objectAtIndex:0];
|
| - *result = FilePath([path fileSystemRepresentation]);
|
| + *result = NSStringToFilePath([dirs objectAtIndex:0]);
|
| return true;
|
| }
|
|
|
| @@ -330,6 +327,18 @@ std::string GetValueFromDictionaryErrorMessage(
|
| " instead";
|
| }
|
|
|
| +NSString* FilePathToNSString(const FilePath& path) {
|
| + return [[NSFileManager defaultManager]
|
| + stringWithFileSystemRepresentation:path.value().c_str()
|
| + length:path.value().size()];
|
| +}
|
| +
|
| +FilePath NSStringToFilePath(NSString* str) {
|
| + if (!str)
|
| + return FilePath();
|
| + return FilePath([str fileSystemRepresentation]);
|
| +}
|
| +
|
| } // namespace mac
|
| } // namespace base
|
|
|
|
|