From 78ce2b473e858cdc32dec82a9337c2dc2c5bab60 Mon Sep 17 00:00:00 2001 From: PavelP Date: Tue, 18 Aug 2020 18:35:21 +0600 Subject: [PATCH] Copy README.md/amalgamate_demo.cpp only if output dir isn't the same as ${SCRIPTPATH} (#1113) + use test's `-ef` file operator to check if ${SCRIPTPATH} and ${AMALGAMATE_OUTPUT_PATH} are not the same --- singleheader/amalgamate.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/singleheader/amalgamate.sh b/singleheader/amalgamate.sh index a71f565d..5dd8c591 100755 --- a/singleheader/amalgamate.sh +++ b/singleheader/amalgamate.sh @@ -127,8 +127,11 @@ echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_C} done } >> ${AMAL_C} -cp -f "${SCRIPTPATH}/amalgamate_demo.cpp" "${DEMOCPP}" -cp -f "${SCRIPTPATH}/README.md" "${README}" +# copy amalgamate_demo.cpp and README.md only if AMALGAMATE_OUTPUT_PATH is not the same as SCRIPTPATH +if [ ! ${SCRIPTPATH} -ef ${AMALGAMATE_OUTPUT_PATH} ]; then + cp -f "${SCRIPTPATH}/amalgamate_demo.cpp" "${DEMOCPP}" + cp -f "${SCRIPTPATH}/README.md" "${README}" +fi echo "Done with all files generation."