2018-10-24 04:49:10 -06: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.
|
2013-04-08 10:41:30 -06:00
|
|
|
|
2023-08-23 07:54:21 -06:00
|
|
|
#include "shell/common/application_info.h"
|
2018-10-24 04:49:10 -06:00
|
|
|
|
2019-05-02 06:05:37 -06:00
|
|
|
#include <string>
|
|
|
|
|
2023-08-23 07:54:21 -06:00
|
|
|
#include "base/mac/foundation_util.h"
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
|
|
#include "shell/common/mac/main_application_bundle.h"
|
2013-04-08 10:41:30 -06:00
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
namespace electron {
|
2013-04-08 10:41:30 -06:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2013-05-28 13:42:52 -06:00
|
|
|
std::string ApplicationInfoDictionaryValue(NSString* key) {
|
2018-04-20 12:47:04 -06:00
|
|
|
return base::SysNSStringToUTF8(
|
|
|
|
[MainApplicationBundle().infoDictionary objectForKey:key]);
|
2013-05-28 13:42:52 -06:00
|
|
|
}
|
|
|
|
|
2013-04-08 10:41:30 -06:00
|
|
|
std::string ApplicationInfoDictionaryValue(CFStringRef key) {
|
2023-08-04 02:47:29 -06:00
|
|
|
NSString* key_ns = const_cast<NSString*>((__bridge const NSString*)(key));
|
2023-07-16 08:14:43 -06:00
|
|
|
return ApplicationInfoDictionaryValue(key_ns);
|
2013-04-08 10:41:30 -06:00
|
|
|
}
|
|
|
|
|
2017-03-31 12:18:20 -06:00
|
|
|
} // namespace
|
2013-04-08 10:41:30 -06:00
|
|
|
|
|
|
|
std::string GetApplicationName() {
|
|
|
|
return ApplicationInfoDictionaryValue(kCFBundleNameKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetApplicationVersion() {
|
2013-05-28 13:42:52 -06:00
|
|
|
return ApplicationInfoDictionaryValue(@"CFBundleShortVersionString");
|
2013-04-08 10:41:30 -06:00
|
|
|
}
|
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
} // namespace electron
|