Browse Source

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.
Daniel Friesen 9 years ago
parent
commit
54375cc7a4

+ 1
- 1
ArduinoAddons/Arduino_1.5.x/hardware/marlin/avr/platform.local.txt View File

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

+ 14
- 14
LinuxAddons/bin/generate_version_header_for_marlin View File

1
 #!/usr/bin/env bash
1
 #!/usr/bin/env bash
2
 # generate_version_header_for_marlin
2
 # generate_version_header_for_marlin
3
 
3
 
4
-DIR=$1 export DIR
5
-OUTFILE=$2 export OUTFILE
6
-echo "/* This file is automatically generated by an Arduino hook" >$OUTFILE
7
-echo " * Do not manually edit it" >>$OUTFILE
8
-echo " * It does not get committed to the repository" >>$OUTFILE
9
-echo " */" >>$OUTFILE
10
-echo "" >>$OUTFILE
4
+DIR="$1" export DIR
5
+OUTFILE="$2" export OUTFILE
6
+echo "/* This file is automatically generated by an Arduino hook" >"$OUTFILE"
7
+echo " * Do not manually edit it" >>"$OUTFILE"
8
+echo " * It does not get committed to the repository" >>"$OUTFILE"
9
+echo " */" >>"$OUTFILE"
10
+echo "" >>"$OUTFILE"
11
 
11
 
12
-echo "#define BUILD_UNIX_DATETIME" `date +%s` >>$OUTFILE
13
-echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE
12
+echo "#define BUILD_UNIX_DATETIME" `date +%s` >>"$OUTFILE"
13
+echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>"$OUTFILE"
14
 ( set +e
14
 ( set +e
15
-  cd $DIR
15
+  cd "$DIR"
16
   BRANCH=`git symbolic-ref --short HEAD`
16
   BRANCH=`git symbolic-ref --short HEAD`
17
   if [ "x$BRANCH" == "xHEAD" ] ; then
17
   if [ "x$BRANCH" == "xHEAD" ] ; then
18
     BRANCH=""
18
     BRANCH=""
23
   fi
23
   fi
24
   VERSION=`git describe --tags --first-parent 2>/dev/null` 
24
   VERSION=`git describe --tags --first-parent 2>/dev/null` 
25
   if [ "x$VERSION" != "x" ] ; then
25
   if [ "x$VERSION" != "x" ] ; then
26
-    echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>$OUTFILE
26
+    echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>"$OUTFILE"
27
   fi
27
   fi
28
   URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"`
28
   URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"`
29
   if [ "x$URL" != "x" ] ; then
29
   if [ "x$URL" != "x" ] ; then
30
-    echo "#define SOURCE_CODE_URL  \""$URL"\"" >>$OUTFILE
31
-    echo "// Deprecated URL definition" >>$OUTFILE
32
-    echo "#define FIRMWARE_URL  \""$URL"\"" >>$OUTFILE
30
+    echo "#define SOURCE_CODE_URL  \""$URL"\"" >>"$OUTFILE"
31
+    echo "// Deprecated URL definition" >>"$OUTFILE"
32
+    echo "#define FIRMWARE_URL  \""$URL"\"" >>"$OUTFILE"
33
   fi
33
   fi
34
   
34
   
35
 )
35
 )

Loading…
Cancel
Save