Allow custom symbols to be sub-directories.

This commit is contained in:
grossmj 2018-08-13 00:16:02 +07:00
parent 29620f4ea3
commit daa2de4541

View File

@ -55,18 +55,17 @@ class Symbols:
directory = self.symbols_path() directory = self.symbols_path()
if directory: if directory:
for file in os.listdir(directory): for root, _, files in os.walk(directory):
if file.startswith('.'): for filename in files:
continue if filename.startswith('.'):
if not os.path.isfile(os.path.join(directory, file)): continue
continue symbol_file = os.path.relpath(os.path.join(root, filename), directory)
symbol_id = file symbols.append({
symbols.append({ 'symbol_id': symbol_file,
'symbol_id': symbol_id, 'filename': symbol_file,
'filename': file, 'builtin': False,
'builtin': False, })
}) self._symbols_path[symbol_file] = os.path.join(root, filename)
self._symbols_path[symbol_id] = os.path.join(directory, file)
symbols.sort(key=lambda x: x["filename"]) symbols.sort(key=lambda x: x["filename"])
return symbols return symbols