summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitIR <git@zachir.xyz>2023-07-10 22:35:58 -0500
committerGitIR <git@zachir.xyz>2023-07-10 22:35:58 -0500
commita2775379b7ee020f5da2528256fc7400c0847e58 (patch)
tree67324632ed77dba379345f1eb3d65789defb1918
parentcbe59feb58690b2606bdd7abc2c53cae6b06bf75 (diff)
Add PATH checking if dir exists
-rw-r--r--zsh/.zshenv86
1 files changed, 65 insertions, 21 deletions
diff --git a/zsh/.zshenv b/zsh/.zshenv
index 228d6f8..70b37b1 100644
--- a/zsh/.zshenv
+++ b/zsh/.zshenv
@@ -79,26 +79,70 @@ export SRCDIR="$HOME/.local/src"
export ENV="$XDG_CONFIG_HOME/mksh/mkshrc"
# PATH
-export PATH="$HOME/.local/bin/testing"
-export PATH="$PATH:$HOME/.local/bin/shortcmds"
-export PATH="$PATH:$HOME/.local/bin/generics"
-export PATH="$PATH:$HOME/.local/bin/scripts"
-export PATH="$PATH:$HOME/.local/bin/sp"
-export PATH="$PATH:$HOME/.local/bin/blocks"
-export PATH="$PATH:$HOME/.local/bin/ignore"
-export PATH="$PATH:$HOME/.local/bin"
-export PATH="$PATH:$HOME/.local/bin/flatpak-sc"
-export PATH="$PATH:$HOME/.local/share/flatpak/exports/bin/"
-export PATH="$PATH:$CARGO_HOME/bin"
-export PATH="$PATH:$GOPATH/bin"
-export PATH="$PATH:/opt/REAPER"
-export PATH="$PATH:/usr/local/bin"
-export PATH="$PATH:/usr/local/sbin"
-export PATH="$PATH:/opt/safing/portmaster"
-export PATH="$PATH:/var/lib/flatpak/exports/bin"
-export PATH="$PATH:/usr/bin"
-export PATH="$PATH:/usr/sbin"
-export PATH="$PATH:/bin"
-export PATH="$PATH:/sbin"
+if [ -d "$HOME/.local/bin/testing" ]; then
+ export PATH="$HOME/.local/bin/testing"
+fi
+if [ -d "$HOME/.local/bin/shortcmds" ]; then
+ export PATH="$PATH:$HOME/.local/bin/shortcmds"
+fi
+if [ -d "$HOME/.local/bin/generics" ]; then
+ export PATH="$PATH:$HOME/.local/bin/generics"
+fi
+if [ -d "$HOME/.local/bin/scripts" ]; then
+ export PATH="$PATH:$HOME/.local/bin/scripts"
+fi
+if [ -d "$HOME/.local/bin/sp" ]; then
+ export PATH="$PATH:$HOME/.local/bin/sp"
+fi
+if [ -d "$HOME/.local/bin/blocks" ]; then
+ export PATH="$PATH:$HOME/.local/bin/blocks"
+fi
+if [ -d "$HOME/.local/bin/ignore" ]; then
+ export PATH="$PATH:$HOME/.local/bin/ignore"
+fi
+if [ -d "$HOME/.local/bin" ]; then
+ export PATH="$PATH:$HOME/.local/bin"
+fi
+if [ -d "$HOME/.local/bin/flatpak-sc" ]; then
+ export PATH="$PATH:$HOME/.local/bin/flatpak-sc"
+fi
+if [ -d "$HOME/.local/bin/flatpak/exports/bin" ]; then
+ export PATH="$PATH:$HOME/.local/share/flatpak/exports/bin/"
+fi
+if [ -d "$CARGO_HOME/bin" ]; then
+ export PATH="$PATH:$CARGO_HOME/bin"
+fi
+if [ -d "$GOPATH/bin" ]; then
+ export PATH="$PATH:$GOPATH/bin"
+fi
+if [ -d "/opt/REAPER" ]; then
+ export PATH="$PATH:/opt/REAPER"
+fi
+if [ -d "/usr/local/bin" ]; then
+ export PATH="$PATH:/usr/local/bin"
+fi
+if [ -d "/usr/local/sbin" ]; then
+ export PATH="$PATH:/usr/local/sbin"
+fi
+if [ -d "/opt/safing/portmaster" ]; then
+ export PATH="$PATH:/opt/safing/portmaster"
+fi
+if [ -d "/var/lib/flatpak/exports/bin" ]; then
+ export PATH="$PATH:/var/lib/flatpak/exports/bin"
+fi
+if [ -d "/usr/bin" ]; then
+ export PATH="$PATH:/usr/bin"
+fi
+if [ -d "/usr/sbin" ]; then
+ export PATH="$PATH:/usr/sbin"
+fi
+if [ -d "/bin" ]; then
+ export PATH="$PATH:/bin"
+fi
+if [ -d "/sbin" ]; then
+ export PATH="$PATH:/sbin"
+fi
+
+[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
[ -f /etc/profile.d/nix-daemon.sh ] && . /etc/profile.d/nix-daemon.sh