mirror of
https://github.com/electron/electron.git
synced 2026-01-27 08:18:28 -05:00
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.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user