mirror of https://codeberg.org/h3xx/optipdf
Use a temp directory for temporary files
This commit is contained in:
parent
c7e6ff5a3e
commit
306fb7e8c9
8
optipdf
8
optipdf
|
@ -42,9 +42,9 @@ KEEP_BACKUP_SUFFIX=
|
|||
FORCE_OVERWRITE=0
|
||||
ENCODE_THRU_WARNINGS=0
|
||||
|
||||
TEMP_FILES=()
|
||||
TEMP_DIR=$(mktemp -d -t "${0##*/}.XXXXXX")
|
||||
cleanup() {
|
||||
rm -f -- "${TEMP_FILES[@]}"
|
||||
rm -fr -- "$TEMP_DIR"
|
||||
}
|
||||
trap 'cleanup' EXIT
|
||||
|
||||
|
@ -222,9 +222,6 @@ use_smaller() {
|
|||
|
||||
}
|
||||
|
||||
TEMP=$(mktemp -t "${0##*/}.XXXXXX")
|
||||
TEMP_FILES+=("$TEMP")
|
||||
|
||||
QPDF_ARGS=(
|
||||
--compression-level=9
|
||||
--deterministic-id
|
||||
|
@ -248,6 +245,7 @@ fi
|
|||
ERRORS=0
|
||||
FREED_TOTAL=0
|
||||
for FILE in "${FILES[@]}"; do
|
||||
TEMP=$(mktemp -p "$TEMP_DIR" -t 'file.XXXXXX')
|
||||
rm -f -- "$TEMP"
|
||||
BEGIN_FILESIZE=$(file_size "$FILE")
|
||||
|
||||
|
|
Loading…
Reference in New Issue