diff --git a/install-scripts/uninstall-safe-chain.ps1 b/install-scripts/uninstall-safe-chain.ps1 index f1e1ff7..5fdae1c 100644 --- a/install-scripts/uninstall-safe-chain.ps1 +++ b/install-scripts/uninstall-safe-chain.ps1 @@ -4,7 +4,9 @@ # Use HOME on Unix, USERPROFILE on Windows (PowerShell Core is cross-platform) $HomeDir = if ($env:HOME) { $env:HOME } else { $env:USERPROFILE } -$InstallDir = Join-Path $HomeDir ".safe-chain/bin" +$DotSafeChain = Join-Path $HomeDir ".safe-chain" +$DotAikido = Join-Path $HomeDir ".aikido" +$InstallDir = Join-Path $DotSafeChain "bin" # Helper functions function Write-Info { @@ -123,34 +125,34 @@ function Uninstall-SafeChain { Remove-NpmInstallation Remove-VoltaInstallation - # Remove installation directory - if (Test-Path $InstallDir) { - Write-Info "Removing installation directory: $InstallDir" + # Remove .safe-chain directory + if (Test-Path $DotSafeChain) { + Write-Info "Removing installation directory: $DotSafeChain" try { - Remove-Item -Path $InstallDir -Recurse -Force + Remove-Item -Path $DotSafeChain -Recurse -Force Write-Info "Successfully removed installation directory" } catch { - Write-Error-Custom "Failed to remove $InstallDir : $_" + Write-Error-Custom "Failed to remove $DotSafeChain : $_" } } else { - Write-Info "Installation directory $InstallDir does not exist. Nothing to remove." + Write-Info "Installation directory $DotSafeChain does not exist. Nothing to remove." } - # Also try to remove the parent .safe-chain directory if it's empty - $parentDir = Split-Path $InstallDir -Parent - if (Test-Path $parentDir) { - $items = Get-ChildItem -Path $parentDir -Force - if ($items.Count -eq 0) { - Write-Info "Removing empty parent directory: $parentDir" - try { - Remove-Item -Path $parentDir -Force - } - catch { - Write-Warn "Could not remove empty parent directory: $_" - } + # Remove .aikido directory + if (Test-Path $DotAikido) { + Write-Info "Removing installation directory: $DotAikido" + try { + Remove-Item -Path $DotAikido -Recurse -Force + Write-Info "Successfully removed installation directory" } + catch { + Write-Error-Custom "Failed to remove $DotAikido : $_" + } + } + else { + Write-Info "Installation directory $DotAikido does not exist. Nothing to remove." } Write-Info "safe-chain has been uninstalled successfully!" diff --git a/install-scripts/uninstall-safe-chain.sh b/install-scripts/uninstall-safe-chain.sh index e208319..0d04128 100755 --- a/install-scripts/uninstall-safe-chain.sh +++ b/install-scripts/uninstall-safe-chain.sh @@ -7,7 +7,8 @@ set -e # Exit on error # Configuration -INSTALL_DIR="${HOME}/.safe-chain/bin" +DOT_SAFE_CHAIN="${HOME}/.safe-chain" +DOT_AIKIDO="${HOME}/.aikido" # Colors for output RED='\033[0;31m' @@ -139,7 +140,7 @@ remove_nvm_installation() { # Main uninstallation main() { - SAFE_CHAIN_LOCATION="$INSTALL_DIR/safe-chain" + SAFE_CHAIN_LOCATION="$DOT_SAFE_CHAIN/bin/safe-chain" if [ -x "$SAFE_CHAIN_LOCATION" ]; then info "Running safe-chain teardown..." @@ -157,11 +158,19 @@ main() { remove_nvm_installation # Remove install dir recursively if it exists - if [ -d "$INSTALL_DIR" ]; then - info "Removing installation directory $INSTALL_DIR" - rm -rf "$INSTALL_DIR" || error "Failed to remove $INSTALL_DIR" + if [ -d "$DOT_SAFE_CHAIN" ]; then + info "Removing installation directory $DOT_SAFE_CHAIN" + rm -rf "$DOT_SAFE_CHAIN" || error "Failed to remove $DOT_SAFE_CHAIN" else - info "Installation directory $INSTALL_DIR does not exist. Nothing to remove." + info "Installation directory $DOT_SAFE_CHAIN does not exist. Nothing to remove." + fi + + # Remove install dir recursively if it exists + if [ -d "$DOT_AIKIDO" ]; then + info "Removing installation directory $DOT_AIKIDO" + rm -rf "$DOT_AIKIDO" || error "Failed to remove $DOT_AIKIDO" + else + info "Installation directory $DOT_AIKIDO does not exist. Nothing to remove." fi }