Browse Source

Fix suggested output dir to be the same as input file

master
Benjamin Renard 5 years ago
parent
commit
c7830ec1d3
  1. 8
      src/usr/bin/compress-pdf

8
src/usr/bin/compress-pdf

@ -139,6 +139,12 @@ VERSION="1.1" @@ -139,6 +139,12 @@ VERSION="1.1"
ZENITY=$(which zenity)
pdf_file=$(basename "$1")
if [ $( echo "$1"|grep -c '^\/' ) -eq 0 ]
then
default_output_dir=$( pwd )/$( dirname $1 )
else
default_output_dir=$( dirname $1 )
fi
# Check if Ghostscript is installed
GS="/usr/bin/ghostscript"
@ -189,7 +195,7 @@ case $selected_level in @@ -189,7 +195,7 @@ case $selected_level in
esac
# Choose output file name
suggested_filename=compressed-"$pdf_file"
suggested_filename="$default_output_dir/compressed-$pdf_file"
output_filename=$($ZENITY --file-selection --save --confirm-overwrite --filename="$suggested_filename" --title="$label_filename")
if [ "$?" = 1 ] ; then

Loading…
Cancel
Save