From e604e3432939844cb70ad1a2998ab3bd4aaf0ca9 Mon Sep 17 00:00:00 2001
From: Marty Oehme <contact@martyoeh.me>
Date: Tue, 25 Feb 2025 23:27:57 +0100
Subject: [PATCH] sh: Fix touch error on startup

The xdg-compliance function would check on shell startup if we have a
file mentioned by 'PYTHONSTARTUP' and create it if not.

However, if there is no env var in the shell calling for this at all it
would still try to create a file at an 'empty' path, so this obviously
won't work.

Added a check that we even have the variable to do work.
---
 sh/.config/sh/xdg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sh/.config/sh/xdg b/sh/.config/sh/xdg
index 0b62166..024e330 100644
--- a/sh/.config/sh/xdg
+++ b/sh/.config/sh/xdg
@@ -54,7 +54,7 @@ export LESSHISTFILE="XDG_STATE_HOME/lesshst"
 export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer"
 export NODE_REPL_HISTORY="$XDG_STATE_HOME/node_repl_history"
 export NVM_DIR="$XDG_DATA_HOME/nvm"
-if [ ! -e "$PYTHONSTARTUP" ]; then
+if [ -n "$PYTHONSTARTUP" ] && [ ! -e "$PYTHONSTARTUP" ]; then
     mkdir -p "$XDG_CONFIG_HOME/python"
     touch "$PYTHONSTARTUP"
 fi