Skip to content

Commit 5baca4e

Browse files
committed
v0.4.1
bug fixes: osascript version & Swift checks for alisma
1 parent 56f8a8a commit 5baca4e

File tree

3 files changed

+59
-28
lines changed

3 files changed

+59
-28
lines changed

Linker_QuickAction.sh renamed to Linker_workflow.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/zsh
22
# shellcheck shell=bash
33

4-
# Linker Finder QuickAction (workflow)
4+
# Linker Finder workflow (QuickAction or Service)
55
# version 1.0.1
66

77
export LANG=en_US.UTF-8

README

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Linker is a macOS shell script and Finder QuickAction to create relative or absolute symbolic links, hard links, Finder aliases, Bookmark files, file clones or legacy file copies
22

33
Latest release: https://github.com/JayBrown/Linker/releases/latest
4-
Successfully tested on: macOS 10.15.7 (Catalina)
5-
Not working on: OS X 10.9.5 (Mavericks)
4+
Successfully tested on: macOS 10.15.7 (Catalina) & macOS 10.13.6 (High Sierra)
65

76
* install linker shell script into your $PATH
87

@@ -19,7 +18,9 @@ Not working on: OS X 10.9.5 (Mavericks)
1918
* execute the following, if the script doesn't run: chmod +x ./linker
2019

2120
* Mojave & later: install QuickAction workflow with Automator Installer
22-
* on older systems the QuickAction format is either not supported or might not work properly as a Service workflow, and you need to create your own Service workflow in Automator
21+
* High Sierra & earlier: install the Service workflow with Automator Installer
22+
23+
* Mojave 10.14.3 and earlier (optional): install the Swift 5 Runtime Support for Command Line Tools: https://support.apple.com/kb/DL1998?locale=en_US
2324

2425
In Finder you can just use the QuickAction from the contextual menu (or the Service on older systems).
2526

linker

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/zsh
22
# shellcheck shell=bash
33

4-
# Linker v0.4
4+
# Linker v0.4.1
55

66
export LANG=en_US.UTF-8
77
export SYSTEM_VERSION_COMPAT=0
@@ -11,21 +11,41 @@ uiprocess="Linker"
1111
procid="local.lcars.Linker"
1212

1313
# check system version
14+
swiftlib="/usr/lib/swift/libswiftCore.dylib"
1415
sysvers=$(sw_vers -productVersion)
1516
doublealias=false
17+
noalisma=false
1618
noapfs=false
1719
vmaj=$(echo "$sysvers" | awk -F"." '{print $1}')
1820
if [[ $vmaj -lt 11 ]] ; then
1921
vmin=$(echo "$sysvers" | awk -F"." '{print $2}')
20-
if [[ $vmin -lt 13 ]] ; then # no APFS support
21-
noapfs=true
22-
if [[ $vmin -eq 12 ]] ; then
23-
vfix=$(echo "$sysvers" | awk -F"." '{print $3}')
24-
if [[ $vfix -lt 6 ]] ; then # potentially buggy support for new Alias format: needs to be separated from Bookmark file
25-
doublealias=true
22+
vfix=$(echo "$sysvers" | awk -F"." '{print $3}')
23+
if [[ $vmin -eq 14 ]] ; then
24+
if [[ $vfix -le 3 ]] ; then # Mojave 10.14.3 and earlier: needs Swift libraries for alisma
25+
if ! [[ -f "$swiftlib" ]] ; then
26+
noalisma=true
2627
fi
27-
elif [[ $vmin -lt 12 ]] ; then # old Alias format: needs to be separated from Bookmark file
28-
doublealias=true
28+
fi
29+
elif [[ $vmin -eq 13 ]] ; then # High Sierra: needs Swift libraries for alisma
30+
if ! [[ -f "$swiftlib" ]] ; then
31+
noalisma=true
32+
fi
33+
elif [[ $vmin -le 12 ]] ; then # Sierra and earlier
34+
noapfs=true # no APFS support on Sierra and earlier
35+
if [[ $vmin -ge 11 ]] ; then # Swift libraries needed for: El Capitan & Sierra
36+
if ! [[ -f "$swiftlib" ]] ; then
37+
noalisma=true
38+
else # Swift libraries are present
39+
if [[ $vmin -eq 12 ]] ; then
40+
if [[ $vfix -lt 6 ]] ; then # potentially buggy support for new Alias format: needs to be separated from Bookmark file
41+
doublealias=true
42+
fi
43+
elif [[ $vmin -eq 11 ]] ; then # old Alias format: needs to be separated from Bookmark file
44+
doublealias=true
45+
fi
46+
fi
47+
else # Yosemite and earlier: no Swift library & alisma support
48+
noalisma=true
2949
fi
3050
fi
3151
fi
@@ -184,10 +204,14 @@ elif [[ $1 == "-s" ]] ; then
184204
cli=true
185205
shift
186206
elif [[ $1 == "-b" ]] ; then
187-
if $doublealias ; then
188-
bookmark=true
189-
else
207+
if $noalisma ; then
190208
finderalias=true
209+
else
210+
if $doublealias ; then
211+
bookmark=true
212+
else
213+
finderalias=true
214+
fi
191215
fi
192216
cli=true
193217
shift
@@ -3486,26 +3510,32 @@ fi
34863510

34873511
# export additional path & check for availability of alisma
34883512
export PATH=$PATH:"$bindir"
3489-
xalisma=true
3490-
if ! command -v alisma &>/dev/null ; then
3491-
chmod +x "$bindir/alisma" 2>/dev/null
3513+
if $noalisma ; then
3514+
xalisma=false
3515+
else
3516+
xalisma=true
34923517
if ! command -v alisma &>/dev/null ; then
3493-
xalisma=false
3518+
chmod +x "$bindir/alisma" 2>/dev/null
3519+
if ! command -v alisma &>/dev/null ; then
3520+
xalisma=false
3521+
else
3522+
if ! alisma -h | head -1 | grep "^alisma v[1-9] usage:$" &>/dev/null ; then
3523+
xalisma=false
3524+
fi
3525+
fi
34943526
else
34953527
if ! alisma -h | head -1 | grep "^alisma v[1-9] usage:$" &>/dev/null ; then
34963528
xalisma=false
34973529
fi
34983530
fi
3499-
else
3500-
if ! alisma -h | head -1 | grep "^alisma v[1-9] usage:$" &>/dev/null ; then
3501-
xalisma=false
3502-
fi
35033531
fi
35043532
if $cli ; then # standard alias files can always be created via Finder
3505-
if $bookmark && ! $xalisma ; then
3506-
_sysbeep &
3507-
_notify "⚠️ Bookmark files unsupported!" "alisma CLI is missing!"
3508-
exit
3533+
if $bookmark ; then
3534+
if $noalisma || ! $xalisma ; then
3535+
_sysbeep &
3536+
_notify "⚠️ Bookmark files unsupported!" "alisma CLI is missing!"
3537+
exit
3538+
fi
35093539
fi
35103540
fi
35113541

0 commit comments

Comments
 (0)