Skip to content

Commit beea323

Browse files
committed
osx: implement workaround script to change cwd to home dir when launching app from Finder, but leave at current dir when running from command line
1 parent e6560ba commit beea323

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

packaging/osx/Info.plist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict><key>CFBundleShortVersionString</key>
5+
<string>0.0.0</string>
6+
<key>CFBundleExecutable</key>
7+
<string>MacOS/launcher.sh</string>
8+
<key>CFBundleName</key>
9+
<string>PC-BASIC</string>
10+
<key>CFBundleInfoDictionaryVersion</key>
11+
<string>6.0</string>
12+
<key>CFBundleDisplayName</key>
13+
<string>PC-BASIC</string>
14+
<key>CFBundleIconFile</key>
15+
<string>pcbasic.icns</string>
16+
<key>CFBundlePackageType</key>
17+
<string>APPL</string>
18+
<key>LSBackgroundOnly</key>
19+
<string>1</string>
20+
</dict>
21+
</plist>

packaging/osx/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
NAME="pcbasic-$1-osx"
22
pyinstaller installer.spec
3+
# replace executable started by Finder with workaround script to set cwd
4+
cp launcher.sh dist/PC-BASIC.app/Contents/MacOS/
5+
cp Info.plist dist/PC-BASIC.app/Contents/
6+
# build compressed DMG image
37
hdiutil create -srcfolder dist/PC-BASIC.app -volname "PC-BASIC release $1" $NAME.uncompressed.dmg
48
hdiutil convert $NAME.uncompressed.dmg -format UDZO -imagekey zlib-level=9 -o $NAME.dmg
59
rm $NAME.uncompressed.dmg

packaging/osx/launcher.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
DIR="$PWD/`dirname "$0"`"
3+
cd ~
4+
"$DIR/pcbasic" $@

0 commit comments

Comments
 (0)