Closed Jai-JAP closed 3 years ago
I'm pretty sure this won't work because bash isn't expanding that variable anywhere.
the correct way to do it (in my opinion) is to write that file the first time the gui
script runs maybe using pi-apps's runonce
function.
I've added this code to the gui
script's check()
function, in order to solve this issue:
#if username is different (not /home/pi), but dl-location contains /home/pi, delete the file to regenerate it in the subsequent 'if' statement
if [ -f "${DIRECTORY}/data/options/dl-location" ] && [ "$HOME" != '/home/pi' ] && cat "${DIRECTORY}/data/options/dl-location" | grep -q '/home/pi';then
rm -f "${DIRECTORY}/data/options/dl-location"
fi
#regenerate dl-location to use the current home directory
if [ ! -f "${DIRECTORY}/data/options/dl-location" ];then
echo "$HOME/Downloads" > "${DIRECTORY}/data/options/dl-location"
fi
Hopefully it's self-explanatory, but anyone is welcome to ask questions about it.
Have you tested this? :)