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

Unified Diff: base/mac/foundation_util.mm

Issue 10823157: Prettify Mac names, rewrite getDisplayPath API call to focus on $HOME (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: update for benwells Created 8 years, 3 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') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('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 d9cbbfbc487fe1c602f1d4c2de3c7f4fa88ded2e..c5107f7537b094a51fdf02e8ba748021a626cc75 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/mac/foundation_util.h"
+#include "base/mac/mac_util.h"
#include <stdlib.h>
#include <string.h>
@@ -128,6 +129,20 @@ bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result) {
return GetSearchPathDirectory(directory, NSUserDomainMask, result);
}
+std::string GetDisplayNameForPath(const FilePath& path) {
+ FSRef ref;
+ if (!FSRefFromPath(path.value(), &ref))
+ return path.BaseName().value();
+
+ CFStringRef str;
+ if (LSCopyDisplayNameForRef(&ref, &str))
benwells 2012/09/04 06:38:11 add != noErr to make it clear this is a failure
thorogood 2012/09/04 06:45:43 Done.
+ return path.BaseName().value();
+
+ std::string result(base::SysCFStringRefToUTF8(str));
+ NSObjectRelease((void *) str);
+ return result;
+}
+
FilePath GetUserLibraryPath() {
FilePath user_library_path;
if (!GetUserDirectory(NSLibraryDirectory, &user_library_path)) {
« no previous file with comments | « base/mac/foundation_util.h ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698