mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Allow custom symbols to be sub-directories.
This commit is contained in:
parent
29620f4ea3
commit
daa2de4541
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user