sh: Simple pseudo-fix for missing xdg symlink

HACK - it does not reconnect the symlink correctly if its target indeed
returns to the system.
This commit is contained in:
Marty Oehme 2023-03-03 12:54:55 +01:00
parent c92afad510
commit 88ab8c10a6
Signed by: Marty
GPG Key ID: EDBF2ED917B2EF6A
1 changed files with 7 additions and 1 deletions

View File

@ -25,7 +25,8 @@ test "$XDG_DESKTOP_DIR" || export XDG_DESKTOP_DIR="$HOME/desktop"
test "$XDG_DOCUMENTS_DIR" || export XDG_DOCUMENTS_DIR="$HOME/documents"
test "$XDG_DOWNLOAD_DIR" || export XDG_DOWNLOAD_DIR="$HOME/downloads"
export XDG_MUSIC_DIR="$HOME/media/audio/music"
export XDG_MEDIA_DIR="$HOME/media"
export XDG_MUSIC_DIR="$XDG_MEDIA_DIR/audio/music"
export XDG_PICTURES_DIR="$HOME/pictures"
export XDG_VIDEOS_DIR="$HOME/videos"
@ -49,6 +50,11 @@ xdg_makeForUser() {
chmod 0700 "$1"
}
if [ -h "$XDG_MEDIA_DIR" ] && [ ! -e "$XDG_MEDIA_DIR" ]; then
rm "$XDG_MEDIA_DIR"
xdg_makeForUser "$XDG_MEDIA_DIR"
fi
## ensure directories exist
xdg_isThere "$XDG_BIN_HOME" || xdg_makeForUser "$XDG_BIN_HOME"
xdg_isThere "$XDG_CACHE_HOME" || xdg_makeForUser "$XDG_CACHE_HOME"