Use a configuration file (if it exists) to allow the user to set preferred defaults, including TMP_DIR. Also move the initalization of SOURCE above the inclusion of the configuration.

This commit is contained in:
David 2021-10-20 11:57:12 +02:00
parent 2cfa7f6899
commit 1035d998cc

4
scan
View File

@ -31,6 +31,7 @@ DESKEW=0
DRIVER_OPTION=
VERBOSE=0
SKIP_EMPTY_PAGES=0
SOURCE=""
TMP_DIR=$(mktemp -d -p "" scan.XXXXXXXXXX)
cleanup()
@ -39,6 +40,8 @@ cleanup()
}
trap cleanup EXIT
[ -e "${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/defaults" ] && . "${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/defaults"
# Parse command-line options
while [[ $# > 0 ]]; do
case "$1" in
@ -191,7 +194,6 @@ if [[ $USEARRAY == 1 ]]; then
OUTPUT=("${OUTPUTARR[@]}")
fi
SOURCE=""
if [[ $DUPLEX == 1 ]]; then
SOURCE="--source \"ADF Duplex\""
fi