summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-09-29 18:17:32 +0200
committerAkemi <der.richter@gmx.de>2017-10-03 11:30:56 +0200
commit77021cf6fe6a1813b832c8927c288e958b6f6845 (patch)
tree85c5e6d0b230337541edb0b05c9fa7465daf5f51 /TOOLS
parent0c04ce5f0d9c4fb7311edf0ae7bdf1eef0f61235 (diff)
downloadmpv-77021cf6fe6a1813b832c8927c288e958b6f6845.tar.bz2
mpv-77021cf6fe6a1813b832c8927c288e958b6f6845.tar.xz
osx: fix bundle on macOS High Sierra (10.13)
Apple slightly changed the App bundle mechanism which broke wrapper scripts that invoke the actual binary. it caused the bundle to always open a new instance of mpv instead of reusing the currently running one. just removing the wrapper script would lead to several regressions, so it was replaced with a symlink to the bundle binary. detection if mpv was started from the bundle was replaced by comparing the execution name of the binary, eg the name of the symlink "mpv-bundle". additionally, because we load a standard config from the Resources folder of the bundle again, we prevent that config from being loaded if mpv wasn't started via the bundle. the psn argument has to be removed manually again. the ability of loading your standard shell environment has been removed with the wrapper. a substitution will be added with another commit. as a side effect this fixes an issues when zsh was used with common NodeJS configuration scripts. Fixes #4926 #4866
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/osxbundle.py6
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Info.plist2
-rwxr-xr-xTOOLS/osxbundle/mpv.app/Contents/MacOS/mpv-wrapper.sh13
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf1
4 files changed, 8 insertions, 14 deletions
diff --git a/TOOLS/osxbundle.py b/TOOLS/osxbundle.py
index e9ef8bc4de..ba0efd9e7e 100755
--- a/TOOLS/osxbundle.py
+++ b/TOOLS/osxbundle.py
@@ -39,6 +39,10 @@ def apply_plist_template(plist_file, version):
for line in fileinput.input(plist_file, inplace=1):
print (line.rstrip().replace('${VERSION}', version))
+def create_bundle_symlink(binary_name, symlink_name):
+ os.symlink(os.path.basename(binary_name),
+ os.path.join(target_directory(binary_name), symlink_name))
+
def bundle_version():
if os.path.exists('VERSION'):
x = open('VERSION')
@@ -69,6 +73,8 @@ def main():
copy_bundle(binary_name)
print("> copying binary")
copy_binary(binary_name)
+ print("> create bundle symlink")
+ create_bundle_symlink(binary_name, "mpv-bundle")
print("> generating Info.plist")
apply_plist_template(target_plist(binary_name), version)
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Info.plist b/TOOLS/osxbundle/mpv.app/Contents/Info.plist
index 11e34c4548..89ff4bf6ad 100644
--- a/TOOLS/osxbundle/mpv.app/Contents/Info.plist
+++ b/TOOLS/osxbundle/mpv.app/Contents/Info.plist
@@ -173,7 +173,7 @@
</dict>
</array>
<key>CFBundleExecutable</key>
- <string>mpv-wrapper.sh</string>
+ <string>mpv-bundle</string>
<key>CFBundleIconFile</key>
<string>icon</string>
<key>CFBundleIdentifier</key>
diff --git a/TOOLS/osxbundle/mpv.app/Contents/MacOS/mpv-wrapper.sh b/TOOLS/osxbundle/mpv.app/Contents/MacOS/mpv-wrapper.sh
deleted file mode 100755
index f84c27a6e2..0000000000
--- a/TOOLS/osxbundle/mpv.app/Contents/MacOS/mpv-wrapper.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-export MPVBUNDLE="true"
-
-# set the right args for the user specified standard shell
-# to load the expected profiles and configs
-args="-c"
-case "$SHELL" in
- *bash) args="-l $args";;
- *zsh) args="-l -i $args";;
-esac
-
-cd "$(dirname "$0")"
-$SHELL $args "./mpv --player-operation-mode=pseudo-gui"
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf b/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf
new file mode 100644
index 0000000000..bdffa7a951
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf
@@ -0,0 +1 @@
+player-operation-mode=pseudo-gui