From d09a316d7ae990bdfbd3630a289b27f2dfeb5ec3 Mon Sep 17 00:00:00 2001 From: jeffkowalski Date: Sat, 18 Aug 2012 19:24:07 -0700 Subject: [PATCH] Added autodetection of ARDUINO_SKETCHBOOK, by looking to match IDE's setting in $(HOME)/.arduino/preferences.txt before setting default of $(HOME)/sketchbook. --- arduino-mk/Arduino.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 9cd973f..e08fd62 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -405,7 +405,19 @@ endif # Miscellanea # ifndef ARDUINO_SKETCHBOOK - ARDUINO_SKETCHBOOK = $(HOME)/sketchbook + ifneq ($(wildcard $(HOME)/.arduino/preferences.txt),) + ARDUINO_SKETCHBOOK = $(shell grep --max-count=1 --regexp="sketchbook.path=" \ + $(HOME)/.arduino/preferences.txt | \ + sed -e 's/sketchbook.path=//' ) + endif + ifneq ($(ARDUINO_SKETCHBOOK),) + $(call show_config_variable,ARDUINO_SKETCHBOOK,[AUTODETECTED],(in arduino preferences file)) + else + ARDUINO_SKETCHBOOK = $(HOME)/sketchbook + $(call show_config_variable,ARDUINO_SKETCHBOOK,[DEFAULT]) + endif +else + $(call show_config_variable,ARDUINO_SKETCHBOOK) endif ifndef USER_LIB_PATH