STYLE: avoid spurious messages when cloning cases

- either (or both) of 0/, 0.orig/ may exist, so error messages about
  one of them being missing is a bit misleading
This commit is contained in:
Mark Olesen
2017-02-09 13:41:48 +01:00
parent ff2a335310
commit 0067c9e369

23
bin/tools/RunFunctions Executable file → Normal file
View File

@ -208,19 +208,32 @@ compileApplication()
wmake $1
}
#
# cloneCase srcDir dstDir
#
cloneCase()
{
if [ -d "$2" ]
if [ -e "$2" ]
then
echo "Case already cloned: remove case directory $2 to clone"
else
elif [ -d "$1" ]
then
echo "Cloning $2 case from $1"
mkdir $2
cpfiles="0.orig 0 system constant"
for f in $cpfiles
# These must exist, so do not hide error messages
for f in system constant
do
\cp -r $1/$f $2
done
# Either (or both) may exist, so error messages may be spurious
for f in 0 0.orig
do
\cp -r $1/$f $2 2>/dev/null
done
else
echo "Error: cannot clone from non-existent directory"
echo " $1"
fi
}
@ -243,7 +256,7 @@ restore0Dir()
if [ -d 0.orig ]
then
\rm -rf 0
\cp -r 0.orig 0 > /dev/null 2>&1
\cp -r 0.orig 0 2>/dev/null
else
echo " Warning: no 0.orig/ found"
fi