From c55cc788bba09ca3d0070ca66303c973379a3b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 9 Feb 2022 09:21:46 +0100 Subject: [PATCH] Update functions.sh --- fragments/functions.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fragments/functions.sh b/fragments/functions.sh index a851077..54e427b 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -220,13 +220,21 @@ getAppVersion() { fi fi - # get app in /Applications, or /Applications/Utilities, or find using Spotlight - if [[ -d "/Applications/$appName" ]]; then + # get app in targetDir, /Applications, or /Applications/Utilities + if [[ -d "$targetDir/$appName" ]]; then + applist="$targetDir/$appName" + elif [[ -d "/Applications/$appName" ]]; then applist="/Applications/$appName" + if [[ $type =~ '^(dmg|zip|tbz|app.*)$']]; then + targetDir="/Applications" + fi elif [[ -d "/Applications/Utilities/$appName" ]]; then applist="/Applications/Utilities/$appName" - else - applist=$(mdfind "kind:application $appName" -0 ) + if [[ $type =~ '^(dmg|zip|tbz|app.*)$']]; then + targetDir="/Applications/Utilities" + fi + #else + # applist=$(mdfind "kind:application $appName" -0 ) fi if [[ -z applist ]]; then printlog "No previous app found" DEBUG