Quote paths so build scripts work when directories have space in their name.

Currently if you clone Marlin to a directory with a space in the name, Arduino will generate an error.
Because when executed the path ends up split into two separate arguments.
master
Daniel Friesen 9 years ago committed by Richard Wackerbarth
parent bdf778bec2
commit 54375cc7a4

@ -1,2 +1,2 @@
compiler.cpp.extra_flags=-DHAS_AUTOMATIC_VERSIONING compiler.cpp.extra_flags=-DHAS_AUTOMATIC_VERSIONING
recipe.hooks.prebuild.pattern=/usr/local/bin/generate_version_header_for_marlin {build.source.path} {build.path}/_Version.h recipe.hooks.prebuild.pattern=/usr/local/bin/generate_version_header_for_marlin "{build.source.path}" "{build.path}/_Version.h"

@ -1,18 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# generate_version_header_for_marlin # generate_version_header_for_marlin
DIR=$1 export DIR DIR="$1" export DIR
OUTFILE=$2 export OUTFILE OUTFILE="$2" export OUTFILE
echo "/* This file is automatically generated by an Arduino hook" >$OUTFILE echo "/* This file is automatically generated by an Arduino hook" >"$OUTFILE"
echo " * Do not manually edit it" >>$OUTFILE echo " * Do not manually edit it" >>"$OUTFILE"
echo " * It does not get committed to the repository" >>$OUTFILE echo " * It does not get committed to the repository" >>"$OUTFILE"
echo " */" >>$OUTFILE echo " */" >>"$OUTFILE"
echo "" >>$OUTFILE echo "" >>"$OUTFILE"
echo "#define BUILD_UNIX_DATETIME" `date +%s` >>$OUTFILE echo "#define BUILD_UNIX_DATETIME" `date +%s` >>"$OUTFILE"
echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>"$OUTFILE"
( set +e ( set +e
cd $DIR cd "$DIR"
BRANCH=`git symbolic-ref --short HEAD` BRANCH=`git symbolic-ref --short HEAD`
if [ "x$BRANCH" == "xHEAD" ] ; then if [ "x$BRANCH" == "xHEAD" ] ; then
BRANCH="" BRANCH=""
@ -23,13 +23,13 @@ echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE
fi fi
VERSION=`git describe --tags --first-parent 2>/dev/null` VERSION=`git describe --tags --first-parent 2>/dev/null`
if [ "x$VERSION" != "x" ] ; then if [ "x$VERSION" != "x" ] ; then
echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>$OUTFILE echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>"$OUTFILE"
fi fi
URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"` URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"`
if [ "x$URL" != "x" ] ; then if [ "x$URL" != "x" ] ; then
echo "#define SOURCE_CODE_URL \""$URL"\"" >>$OUTFILE echo "#define SOURCE_CODE_URL \""$URL"\"" >>"$OUTFILE"
echo "// Deprecated URL definition" >>$OUTFILE echo "// Deprecated URL definition" >>"$OUTFILE"
echo "#define FIRMWARE_URL \""$URL"\"" >>$OUTFILE echo "#define FIRMWARE_URL \""$URL"\"" >>"$OUTFILE"
fi fi
) )

Loading…
Cancel
Save