Fix suggested output dir to be the same as input file

This commit is contained in:
Benjamin Renard 2017-04-17 23:32:23 +02:00
parent 239665f3f5
commit c7830ec1d3

View file

@ -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
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