From 9bedfa9a72e6e6b723f3808cfda33cd4077a87af Mon Sep 17 00:00:00 2001 From: fritz-hh Date: Tue, 7 Oct 2014 16:42:10 +0200 Subject: [PATCH] fixes #95 Exit if the output path points to a folder Exit if the output path point to an existing file --- OCRmyPDF.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OCRmyPDF.sh b/OCRmyPDF.sh index c5a85a1a..8ffa824b 100644 --- a/OCRmyPDF.sh +++ b/OCRmyPDF.sh @@ -134,12 +134,13 @@ if [ "$SKIP_TEXT" -eq "1" -a "$FORCE_OCR" -eq "1" ]; then fi -[ ! -f "$1" ] \ - && echo "The input file does not exist. Exiting..." && exit $EXIT_BAD_ARGS +[ ! -f "$1" ] && echo "The input file does not exist. Exiting..." && exit $EXIT_BAD_ARGS FILE_INPUT_PDF="`absolutePath "$1"`" -! absolutePath "$2" > /dev/null \ +! absolutePath "$2" >/dev/null \ && echo "The folder in which the output file should be generated does not exist. Exiting..." && exit $EXIT_BAD_ARGS +[ -d "$2" ] && echo "Please enter the path of the file to be generated (and not a path to a folder). Exitíng..." && exit $EXIT_BAD_ARGS +[ -f "$2" ] && echo "The output file already exists. Exiting..." && exit $EXIT_BAD_ARGS FILE_OUTPUT_PDFA="`absolutePath "$2"`"