I want to let every file know the path of the root of a project. For example let’s consider this the root: /home/username/.config/project
. If I have a folder in the project and every file in the folder has a line like ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
(gets the absolute path of the parent directory) whenever I move the folder to another location I may have to change that line for every file in the folder.
Is there a better option to let every file know the path of the project root?
I think using paths relative to
${BASH_SOURCE[0]}
is alright.Otherwise, using
${XDG_CONFIG_HOME:-$HOME/.config}
is pretty standard.