https://manpages.ubuntu.com/manpages/focus/man1/xdg-user-dirs-update.1.html
파일에 마지막 디렉터리만 설정된 이유는 무엇입니까 xdg-user-dirs
?
% xdg-user-dirs-update --dummy-output ~/test \
--set DOCUMENTS $HOME/Apples \
--set MUSIC $HOME/Bananas \
--set PICTURES $HOME/Oranges \
--set VIDEOS $HOME/Pears
% cat ~/test
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_VIDEOS_DIR="$HOME/Pears"
답변1
% cat ~/.dotfiles/config/.config/user-dirs.dirs
XDG_DESKTOP_DIR=
XDG_DOWNLOAD_DIR=
XDG_TEMPLATES_DIR=
XDG_PUBLICSHARE_DIR=
XDG_DOCUMENTS_DIR=
XDG_MUSIC_DIR=
XDG_PICTURES_DIR=
XDG_VIDEOS_DIR=
각 디렉터리를 개별적으로 변경해야 하고 이미 있는 변수(또는 마지막 디렉터리만)만 업데이트해야 하는 것처럼 보입니다. 따라서 위에 표시된 대로 최소한 파일에 원하는 빈 변수를 포함해야 합니다.
Windows WSL을 사용할 때 자동 설정 스크립트를 작성하려고 하는데 결과는 다음과 같습니다.
# Set xdg-user-dirs
xdg-user-dirs-update \
--dummy-output ~/.dotfiles/config/.config/user-dirs.dirs \
--set DOCUMENTS $WIN_HOME/Documents
xdg-user-dirs-update \
--dummy-output ~/.dotfiles/config/.config/user-dirs.dirs \
--set MUSIC $WIN_HOME/Music
xdg-user-dirs-update \
--dummy-output ~/.dotfiles/config/.config/user-dirs.dirs \
--set PICTURES $WIN_HOME/Pictures
xdg-user-dirs-update \
--dummy-output ~/.dotfiles/config/.config/user-dirs.dirs \
--set VIDEOS $WIN_HOME/Videos
% cat ~/.dotfiles/config/.config/user-dirs.dirs
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="/mnt/c/Users/jason/Documents"
XDG_MUSIC_DIR="/mnt/c/Users/jason/Music"
XDG_PICTURES_DIR="/mnt/c/Users/jason/Pictures"
XDG_VIDEOS_DIR="/mnt/c/Users/jason/Videos"