[pushed] wwwdocs: preprocess: Check whether input files exist
Checks
Commit Message
This has not come up in all those years since the preprocess script
usually is invoked from other scripts, notably post commit hooks. It
can, however, be invoked manually, and error handling is generally a
good thing.
Instead of
cat: foo/bar/index.html: No such file or directory
New file /www/gcc/htdocs/foo/bar/index.html
and an empty output file, we now get
Input file foo/bar/index.html not found.
when invoking `preprocess foo/bar/index.html`.
Pushed.
Gerald
---
bin/preprocess | 5 +++++
1 file changed, 5 insertions(+)
@@ -155,6 +155,11 @@ process_file()
# Strip possibly leading "./".
f=`echo $1 | sed -e 's#^\./##'`
+ if [ ! -f "$SOURCETREE/$f" ] wwwdocs:; then
+ echo "Input file $f not found."
+ return
+ fi
+
if [ ! -d "$DESTTREE/`dirname $f`" ] wwwdocs:; then
echo "Creating new directory `dirname $f`."
mkdir -p $DESTTREE/`dirname $f`