electron/shell/common/application_info_mac.mm

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
921 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.
#import "shell/common/application_info.h"
2018-10-24 10:49:10 +00:00
#include <string>
2017-05-18 20:54:11 +00:00
#import "base/mac/foundation_util.h"
#import "base/strings/sys_string_conversions.h"
#import "shell/common/mac/main_application_bundle.h"
2018-10-24 10:49:10 +00:00
namespace electron {
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 electron