Update functions.sh

This commit is contained in:
Søren Theilgaard
2022-02-09 09:21:46 +01:00
parent aea7d282fe
commit c55cc788bb

View File

@@ -220,13 +220,21 @@ getAppVersion() {
fi fi
fi fi
# get app in /Applications, or /Applications/Utilities, or find using Spotlight # get app in targetDir, /Applications, or /Applications/Utilities
if [[ -d "/Applications/$appName" ]]; then if [[ -d "$targetDir/$appName" ]]; then
applist="$targetDir/$appName"
elif [[ -d "/Applications/$appName" ]]; then
applist="/Applications/$appName" applist="/Applications/$appName"
if [[ $type =~ '^(dmg|zip|tbz|app.*)$']]; then
targetDir="/Applications"
fi
elif [[ -d "/Applications/Utilities/$appName" ]]; then elif [[ -d "/Applications/Utilities/$appName" ]]; then
applist="/Applications/Utilities/$appName" applist="/Applications/Utilities/$appName"
else if [[ $type =~ '^(dmg|zip|tbz|app.*)$']]; then
applist=$(mdfind "kind:application $appName" -0 ) targetDir="/Applications/Utilities"
fi
#else
# applist=$(mdfind "kind:application $appName" -0 )
fi fi
if [[ -z applist ]]; then if [[ -z applist ]]; then
printlog "No previous app found" DEBUG printlog "No previous app found" DEBUG