def getArduinoRoot(self): arduino_root = const.settings.get('arduino_root') if not isArduinoRoot(arduino_root): arduino_root = self.getDefaultArduinoRoot() if arduino_root: arduino_root = osfile.getRealPath(arduino_root) return arduino_root
def isArduinoRoot(path): state = False if path and os.path.isdir(path): path = osfile.getRealPath(path) hardware_path = os.path.join(path, 'hardware') lib_path = os.path.join(path, 'lib') version_file_path = os.path.join(lib_path, 'version.txt') if os.path.isdir(hardware_path) and os.path.isfile(version_file_path): state = True return state