Answer the question
In order to leave comments, you need to log in
How to check if a folder is system/user?
Greetings!
There is such a tricky task, you need to check whether the directory is from the $XDG_DATA_DIRS
user or system. Depending on the result, the config will be saved in ~/.config
or in /var/lib
. It will be used in such a simple construction:
_is_system_dir() {
local dir="$1"
if [ "$dir" == something ]; then
return 0
fi
return 1
}
$HOME
it differs from/home
# пользовательские
/home/user/.local/share/
/home/user/.local/share/flatpak/exports/share/
/var/home/user/.local/share/
# системные
/var/lib/flatpak/exports/share/
/usr/share/ubuntu
/usr/local/share/
/usr/share/
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question