From a24c3903186857581602ef8ed27ea75a78e1ad68 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 28 May 2013 15:42:52 -0400 Subject: [PATCH] Use the user-visible version number in our user agent string I.e., use CFBundleShortVersionString instead of CFBundleVersion on OS X and ProductVersion instead of FileVersion on Windows. This is generally more useful (although slightly lower granularity) than the machine-readable version number. --- brightray/common/application_info_mac.mm | 8 ++++++-- brightray/common/application_info_win.cc | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/brightray/common/application_info_mac.mm b/brightray/common/application_info_mac.mm index c6df34e5582d..ee9f9bbf4c5b 100644 --- a/brightray/common/application_info_mac.mm +++ b/brightray/common/application_info_mac.mm @@ -9,8 +9,12 @@ namespace brightray { namespace { +std::string ApplicationInfoDictionaryValue(NSString* key) { + return base::SysNSStringToUTF8([MainApplicationBundle().infoDictionary objectForKey:key]); +} + std::string ApplicationInfoDictionaryValue(CFStringRef key) { - return base::SysNSStringToUTF8([MainApplicationBundle().infoDictionary objectForKey:base::mac::CFToNSCast(key)]); + return ApplicationInfoDictionaryValue(base::mac::CFToNSCast(key)); } } @@ -20,7 +24,7 @@ std::string GetApplicationName() { } std::string GetApplicationVersion() { - return ApplicationInfoDictionaryValue(kCFBundleVersionKey); + return ApplicationInfoDictionaryValue(@"CFBundleShortVersionString"); } } diff --git a/brightray/common/application_info_win.cc b/brightray/common/application_info_win.cc index c099db02f403..8363970ebd85 100644 --- a/brightray/common/application_info_win.cc +++ b/brightray/common/application_info_win.cc @@ -13,7 +13,7 @@ std::string GetApplicationName() { std::string GetApplicationVersion() { auto info = make_scoped_ptr(FileVersionInfo::CreateFileVersionInfoForModule(GetModuleHandle(nullptr))); - return UTF16ToUTF8(info->file_version()); + return UTF16ToUTF8(info->product_version()); } }