In order to foresee the work on the unified packaging process, the
programs/ directory (which should be located in /usr/share/xdg-ninja or
/usr/local/share/xdg-ninja) is automatically found depending on where
the xdg-ninja executable is located.
This also allows for backwards compatibility as when the xdg-ninja
script is located in a working directory (not in a bin/), xdg-ninja
automatically picks the programs/ folder in the current working
directory, just like previously.
If the directory fails to find the programs/ dir, the user can override
the variable XN_PROGRAMS_DIR through environment variables.
This change is to prevent people from packaging xdg-ninja with the
programs/ directory within /usr(/local)/bin or by modifying the script
in place.
-The configuration is done in the _programs/_ directory.
+The configuration is done in the _programs/_ directory, which should be located in the same working directory as the xdg-ninja.sh script. This can be overriden with the `XN_PROGRAMS_DIR` environment variable.
You define a program, and then a list of files and directories which this program ruthlessly puts into your _$HOME_ directory.
You define a program, and then a list of files and directories which this program ruthlessly puts into your _$HOME_ directory.
" read -r name; read -r filename; read -r movable; read -r help; do
check_file "$name" "$filename" "$movable" "$help"
done <<EOF
" read -r name; read -r filename; read -r movable; read -r help; do
check_file "$name" "$filename" "$movable" "$help"
done <<EOF
-$(jq 'inputs as $input | $input.files[] as $file | $input.name, $file.path, $file.movable, $file.help' "$(realpath "$0" | xargs dirname)"/programs/* | sed -e 's/^"//' -e 's/"$//')
+$(jq 'inputs as $input | $input.files[] as $file | $input.name, $file.path, $file.movable, $file.help' "$XN_PROGRAMS_DIR"/* | sed -e 's/^"//' -e 's/"$//')
EOF
# sed is to trim quotes
}
EOF
# sed is to trim quotes
}
+[ "$XN_PROGRAMS_DIR" ] ||
+ XN_PROGRAMS_DIR="$(realpath "$0" | xargs dirname | sed 's:/bin$:/share/xdg-ninja:g')/programs"
+
check_programs
if [ $FIXABLE -gt 100 ]; then
exit 101
check_programs
if [ $FIXABLE -gt 100 ]; then
exit 101