Browse Source

adding check and abort process if the temp file already exists, prob has a 0.000000000000001% chance of happening, but that is not zero anyways

master
Gustavo Neves 8 years ago
parent
commit
69ce95d61e
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      pdfScale.sh

+ 5
- 0
pdfScale.sh View File

@@ -70,6 +70,7 @@ EXIT_MISSING_DEPENDENCY=25
EXIT_IMAGEMAGIK_NOT_FOUND=26
EXIT_MAC_MDLS_NOT_FOUND=27
EXIT_PDFINFO_NOT_FOUND=28
EXIT_TEMP_FILE_EXISTS=40
EXIT_INVALID_PAPER_SIZE=50


@@ -91,6 +92,10 @@ main() {
if isMixedMode; then
outputFile="$OUTFILEPDF" # backup outFile name
tempFile="${OUTFILEPDF%.pdf}.$tempSuffix" # set a temp file name
if isFile "$tempFile"; then
printError $'Error! Temporary file name already exists!\n'"File: $tempFile"$'\nAborting execution to avoid overwriting the file.\nPlease Try again...'
exit $EXIT_TEMP_FILE_EXISTS
fi
OUTFILEPDF="$tempFile" # set output to tmp file
pageResize # resize to tmp file
finalRet=$?


Loading…
Cancel
Save