From 807bc2558797f4ea048bd0abdc6a5f002a978aa5 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 3 Nov 2003 12:31:40 +0000 Subject: [PATCH] Make the search for the generated output file work on Win32 also. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8018 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 7 +++++++ lib/scripts/convertDefault.sh | 22 +++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index c4287ab1ee..93fb17499c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,10 @@ +2003-11-03 Angus Leeming + + * scripts/convertDefault.sh: Do not use 'cut' when checking whether + the output file was generated successfully. Win32 filenames have the + form 'C:\my\file' and use of 'cut' will cause us to look for a file + called 'C'... + 2003-10-23 José Matos * layouts/db_stdcounters.inc: diff --git a/lib/scripts/convertDefault.sh b/lib/scripts/convertDefault.sh index 7f98d4af21..80f4a150f8 100644 --- a/lib/scripts/convertDefault.sh +++ b/lib/scripts/convertDefault.sh @@ -15,18 +15,22 @@ # replacement in ~/.lyx/scripts # converts an image from $1 to $2 format -convert -depth 8 $1 $2 -if [ $? -ne 0 ]; then - exit $? -fi +convert -depth 8 $1 $2 || { + echo "$0 ERROR" + echo "Execution of \"convert\" failed." + exit 1 +} # It appears that convert succeeded, but we know better than to trust it ;-) # convert is passed strings in the form "FMT:FILENAME", so use the ':' to # delimit the two parts. -FILE=`echo $2 | cut -d ':' -f 2` +# Do not use 'cut' because Win32 filenames have the form 'C:\my\file'. +FILE=`echo $arg2 | sed 's,^[^:]*:,,'` -# FSTATUS == 0 is the file exists and == 1 if it does not. -FSTATUS=0 -test -f $FILE || FSTATUS=1 +test -f $FILE || { + echo "$0 ERROR" + echo "Unable to find file \"${FILE}\"" + exit 1 +} -exit $FSTATUS +echo "$0 generated file \"${FILE}\" successfully."