Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: base/mac/foundation_util.mm

Issue 9346013: Publish app shortcuts on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/foundation_util.h ('k') | base/mac/foundation_util_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/foundation_util.mm
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 8ab02abce8e027f28678c8cd475a0be9dfbf5015..891ec13dfc4459e1c2dec71cd014cd676a0fbc3b 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) {
+ if (path.empty())
+ return nil;
+ return [NSString stringWithUTF8String:path.value().c_str()];
+}
+
+FilePath NSStringToFilePath(NSString* str) {
+ if (![str length])
+ return FilePath();
+ return FilePath([str fileSystemRepresentation]);
+}
+
} // namespace mac
} // namespace base
« no previous file with comments | « base/mac/foundation_util.h ('k') | base/mac/foundation_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698