From c1a708a088aafd1eba098a136b9135cb36fe1ee5 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 16 Mar 2023 22:28:28 +0900 Subject: [PATCH] use $PSScriptRoot (other) --- bin/windows/install_key_remaps.ps1 | 10 ++-------- bin/windows/scoop_apps/update_scoop_list.ps1 | 7 ++----- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/bin/windows/install_key_remaps.ps1 b/bin/windows/install_key_remaps.ps1 index fd53087..1197205 100644 --- a/bin/windows/install_key_remaps.ps1 +++ b/bin/windows/install_key_remaps.ps1 @@ -2,14 +2,8 @@ # Be sure to install AutoHotKey first -# check working directory -if (!( - (Test-Path bin) -and (Test-Path dotfiles) - )) { - Write-Warning -Message "wrong current path - please execute at repo root" - exit 1 -} +# change working directory to git root +Set-Location (Join-Path $PSScriptRoot "..") # set Ahk2Exe.exe path # example "C:\Program Files\AutoHotKey\Compiler\Ahk2Exe.exe" diff --git a/bin/windows/scoop_apps/update_scoop_list.ps1 b/bin/windows/scoop_apps/update_scoop_list.ps1 index bdfcb4f..e9f20ad 100644 --- a/bin/windows/scoop_apps/update_scoop_list.ps1 +++ b/bin/windows/scoop_apps/update_scoop_list.ps1 @@ -6,11 +6,8 @@ if(!(Get-Command scoop -ErrorAction SilentlyContinue)) { exit 1 } -# execution location -if(!((Test-Path bin) -and (Test-Path dotfiles))) { - Write-Warning "This script need to be executed in dotfiles root" - exit 2 -} +# change working directory to git root +Set-Location (Join-Path $PSScriptRoot "..") # export to JSON