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,2 +1,2 @@
1 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,18 +1,18 @@
1 1
 #!/usr/bin/env bash
2 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 14
 ( set +e
15
-  cd $DIR
15
+  cd "$DIR"
16 16
   BRANCH=`git symbolic-ref --short HEAD`
17 17
   if [ "x$BRANCH" == "xHEAD" ] ; then
18 18
     BRANCH=""
@@ -23,13 +23,13 @@ echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE
23 23
   fi
24 24
   VERSION=`git describe --tags --first-parent 2>/dev/null` 
25 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 27
   fi
28 28
   URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"`
29 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 33
   fi
34 34
   
35 35
 )

Loading…
Cancel
Save