From a576fae89351851e582549c6817907357a8900ac Mon Sep 17 00:00:00 2001 From: Anton S Date: Mon, 2 Oct 2017 01:04:12 +0300 Subject: [PATCH] [osx] declare URLs support in Info.plist --- scripts/dev/build_release.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index 1e2bd5b6d..612599932 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -26,6 +26,7 @@ import sys import glob import os.path import shutil +import plistlib import subprocess import argparse import tarfile @@ -123,6 +124,19 @@ def patch_mac_app(): os.symlink(os.path.join(os.pardir, os.pardir, os.pardir, 'Contents', 'MacOS', lib), os.path.join(dest, lib)) + # Patch Info.plist to declare URLs support + plist_path = os.path.join(app_path, 'Contents', 'Info.plist') + with open(plist_path, "rb") as f: + plist_data = plistlib.load(f) + plist_data['CFBundleURLTypes'] = [{ + "CFBundleURLName": "http(s) URL", + "CFBundleURLSchemes": ["http", "https"] + }, { + "CFBundleURLName": "local file URL", + "CFBundleURLSchemes": ["file"] + }] + with open(plist_path, "wb") as f: + plistlib.dump(plist_data, f) def build_mac():