def _load_paths(self, paths, depth=0):
        '''
        Goes recursevly through the given list of paths
        in order to find and pass all preset files to ```_load_preset()```
        '''

        if depth > self.MAX_DEPTH:
            return

        for path in paths:
            try:
                # avoid empty string
                if not path:
                    continue

                # cleanUp path
                if depth == 0:
                    path = os.path.expanduser(path)  # replace ~
                    path = os.path.expandvars(path)  # replace vars
                    path = os.path.normpath(path)  # replace /../ , "" will be converted to "."

                if not os.path.exists(path):
                    raise PresetException("does not exists or is a broken link or not enough permissions to read")
                elif os.path.isdir(path):
                    try:
                        for child in os.listdir(path):
                            self._load_paths([os.path.join(path, child)], depth + 1)
                    except OSError as e:
                        raise PresetException("IOError: " + e.strerror)
                elif os.path.isfile(path):
                    if path.endswith(".json"):
                        self._load_preset(path)
                else:
                    raise PresetException("not regular file")
            except PresetException as e:
                e.message = "Failed to load preset: \"{}\" [ {} ]".format(path, e.message)
                if self.strict:
                    raise
                logger.error(str(e))
def _load_paths ( self , paths , depth = 0 ) : if depth > self . MAX_DEPTH : return for path in paths : try : if not path : continue if depth == 0 : path = os . path . expanduser ( path ) path = os . path . expandvars ( path ) path = os . path . normpath ( path ) if not os . path . exists ( path ) : raise PresetException ( "does not exists or is a broken link or not enough permissions to read" ) elif os . path . isdir ( path ) : try : for child in os . listdir ( path ) : self . _load_paths ( [ os . path . join ( path , child ) ] , depth + 1 ) except OSError as e : raise PresetException ( "IOError: " + e . strerror ) elif os . path . isfile ( path ) : if path . endswith ( ".json" ) : self . _load_preset ( path ) else : raise PresetException ( "not regular file" ) except PresetException as e : e . message = "Failed to load preset: \"{}\" [ {} ]" . format ( path , e . message ) if self . strict : raise logger . error ( str ( e ) )
Goes recursevly through the given list of paths
        in order to find and pass all preset files to ```_load_preset()```