electron/shell/common/application_info_mac.mm

37 lines
911 B
Text
Raw Normal View History

2018-10-24 10:49:10 +00:00
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
2018-10-24 10:49:10 +00:00
#import "atom/common/application_info.h"
#include <string>
2018-10-24 10:49:10 +00:00
#import "atom/common/mac/main_application_bundle.h"
2017-05-18 20:54:11 +00:00
#import "base/mac/foundation_util.h"
#import "base/strings/sys_string_conversions.h"
2018-10-24 10:49:10 +00:00
namespace atom {
namespace {
std::string ApplicationInfoDictionaryValue(NSString* key) {
2018-04-20 18:47:04 +00:00
return base::SysNSStringToUTF8(
[MainApplicationBundle().infoDictionary objectForKey:key]);
}
std::string ApplicationInfoDictionaryValue(CFStringRef key) {
return ApplicationInfoDictionaryValue(base::mac::CFToNSCast(key));
}
} // namespace
std::string GetApplicationName() {
return ApplicationInfoDictionaryValue(kCFBundleNameKey);
}
std::string GetApplicationVersion() {
return ApplicationInfoDictionaryValue(@"CFBundleShortVersionString");
}
2018-10-24 10:49:10 +00:00
} // namespace atom