diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index f93ead3..ebb2c5d 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -183,6 +183,8 @@ endif # Some paths # +OSTYPE := $(shell uname) + ifneq (ARDUINO_DIR,) ifndef AVR_TOOLS_PATH @@ -201,8 +203,22 @@ ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/arduino/variants +ifndef ARDUINO_PREFERENCES_PATH + +ifeq ($(OSTYPE),Linux) +ARDUINO_PREFERENCES_PATH = $(HOME)/.arduino/preferences.txt +else +ARDUINO_PREFERENCES_PATH = $(HOME)/Library/Arduino/preferences.txt +endif + +endif + +ifeq ($(wildcard $(ARDUINO_PREFERENCES_PATH)),) +$(error "Error: run the IDE once to initialize preferences sketchbook path") +endif + ifndef ARDUINO_SKETCHBOOK -ARDUINO_SKETCHBOOK = $(HOME)/sketchbook +ARDUINO_SKETCHBOOK = $(shell grep sketchbook.path $(wildcard $(ARDUINO_PREFERENCES_PATH)) | cut -d = -f 2) endif ifndef USER_LIB_PATH