fix(uninstaller): respect $ZDOTDIR and $ZSH variables

The uninstaller hardcodes ~/.oh-my-zsh and ~/.zshrc, which fails for
users who set $ZDOTDIR or installed to a custom $ZSH path. The
installer already handles these variables (tools/install.sh line 62),
but the uninstaller does not, leaving files behind or removing the
wrong directory.

Use ${ZDOTDIR:-$HOME} and ${ZSH:-$HOME/.oh-my-zsh} to match the
installer's conventions. Also pass ZDOTDIR through the env wrapper
in uninstall_oh_my_zsh() so it is available to the sh subprocess.

Closes #11466
Closes #10537

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
marcelsafin 2026-04-07 21:39:37 +02:00
commit 01e779a4d3
2 changed files with 59 additions and 16 deletions

View file

@ -5,7 +5,7 @@ function zsh_stats() {
}
function uninstall_oh_my_zsh() {
command env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh"
command env ZSH="$ZSH" ZDOTDIR="${ZDOTDIR:-}" sh "$ZSH/tools/uninstall.sh"
}
function upgrade_oh_my_zsh() {