Determine preferences file location dynamically.

This commit is contained in:
Christopher Peplin 2012-04-02 12:09:18 -04:00
parent de2b5273ec
commit 83e94515e3

View file

@ -183,6 +183,8 @@ endif
# Some paths # Some paths
# #
OSTYPE := $(shell uname)
ifneq (ARDUINO_DIR,) ifneq (ARDUINO_DIR,)
ifndef AVR_TOOLS_PATH ifndef AVR_TOOLS_PATH
@ -201,8 +203,22 @@ ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/arduino/variants 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 ifndef ARDUINO_SKETCHBOOK
ARDUINO_SKETCHBOOK = $(HOME)/sketchbook ARDUINO_SKETCHBOOK = $(shell grep sketchbook.path $(wildcard $(ARDUINO_PREFERENCES_PATH)) | cut -d = -f 2)
endif endif
ifndef USER_LIB_PATH ifndef USER_LIB_PATH