xdg-user-dirs-updateが複数のディレクトリで機能しない

xdg-user-dirs-updateが複数のディレクトリで機能しない

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"

おすすめ記事