From 5f448434b94c0a2774c8cdb90cc8a47ecb091af1 Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Mon, 1 Feb 2021 21:38:17 +1000 Subject: [PATCH] Updated find_ap.ps1 script Updated to work with new install locations --- .vscode/settings.json | 2 ++ docs/basics/installing.md | 1 + scripts/find_ap.ps1 | 43 ++++++++++++++++++++++----------------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a1902edbb..654f1670a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,8 @@ "Tahoma", "Towsey", "Truskinger", + "choco", + "docfx", "nyquist", "pwsh", "rects" diff --git a/docs/basics/installing.md b/docs/basics/installing.md index d0f7fb080..9c2d46c96 100644 --- a/docs/basics/installing.md +++ b/docs/basics/installing.md @@ -74,6 +74,7 @@ Or, to install the prerelease version: *** + > [!NOTE] > Please inspect which should point to > diff --git a/scripts/find_ap.ps1 b/scripts/find_ap.ps1 index 1c70345fd..726ecf6d0 100644 --- a/scripts/find_ap.ps1 +++ b/scripts/find_ap.ps1 @@ -1,34 +1,39 @@ param() -$command = Get-Command AnalysisPrograms* -ErrorAction SilentlyContinue - -if ($null -ne $command) { - return $command.Path; - exit 0; -} - -if ($IsWindows) { - - $command = Get-Command C:\AP\AnalysisPrograms.exe -ErrorAction SilentlyContinue +function Test-ApDir($path) { + $command = Get-Command $path -ErrorAction SilentlyContinue | Select-Object -First 1 if ($null -ne $command) { - return $command.Path; + Write-Output $command.Path; exit 0; } + } -if ($IsLinux) { - $command = Get-Command /AP/AnalysisPrograms.exe -ErrorAction SilentlyContinue +Test-ApDir "AnalysisPrograms*" - if ($null -ne $command) { - return $command.Path; - exit 0; - } +$old = switch ($null) { + { $IsWindows } { "C:\AP\AnalysisPrograms.exe" } + { $IsLinux } { "/AP/AnalysisPrograms.exe" } + { $IsMacOS } { "/AP/AnalysisPrograms.exe" } + Default { throw "Unknown OS"} } +Test-ApDir $old + +$new = switch ($null) { + { $IsWindows } { "$home\AP\AnalysisPrograms.exe" } + { $IsLinux } { "$HOME/.local/share/AP/AnalysisPrograms.exe" } + { $IsMacOS } { "$HOME/.local/share/AP/AnalysisPrograms.exe" } + Default { throw "Unknown OS"} +} + +Test-ApDir $new + Write-Error @" -Can't find AnalysisPrograms.exe. -Please install it using the instructions from: +Can't find AnalysisPrograms.exe. +Searched on PATH, in $old, and in $new. +Please install it using the instructions from: https://github.com/QutEcoacoustics/audio-analysis/blob/master/docs/installing.md "@