Add team ID to base Bundle ID
authorCheng Zhao <zcbenz@gmail.com>
Thu, 19 May 2016 01:57:57 +0000 (10:57 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 19 May 2016 01:57:57 +0000 (10:57 +0900)
atom/app/atom_main_delegate_mac.mm

index b26d5f4..ea5ab32 100644 (file)
@@ -10,6 +10,7 @@
 #include "base/mac/foundation_util.h"
 #include "base/mac/scoped_nsautorelease_pool.h"
 #include "base/path_service.h"
+#include "base/strings/sys_string_conversions.h"
 #include "brightray/common/application_info.h"
 #include "brightray/common/mac/main_application_bundle.h"
 #include "content/public/common/content_paths.h"
@@ -52,8 +53,13 @@ void AtomMainDelegate::OverrideChildProcessPath() {
 
 void AtomMainDelegate::SetUpBundleOverrides() {
   base::mac::ScopedNSAutoreleasePool pool;
-  NSBundle* base_bundle = brightray::MainApplicationBundle();
-  base::mac::SetBaseBundleID([[base_bundle bundleIdentifier] UTF8String]);
+  NSBundle* bundle = brightray::MainApplicationBundle();
+  std::string base_bundle_id =
+      base::SysNSStringToUTF8([bundle bundleIdentifier]);
+  NSString* team_id = [bundle objectForInfoDictionaryKey:@"ElectronTeamID"];
+  if (team_id)
+    base_bundle_id = base::SysNSStringToUTF8(team_id) + "." + base_bundle_id;
+  base::mac::SetBaseBundleID(base_bundle_id.c_str());
 }
 
 }  // namespace atom