mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-13 04:48:22 +00:00
Support listing images in subdirectories
It's a part of the OVA support: https://github.com/GNS3/gns3-gui/issues/700
This commit is contained in:
@ -439,15 +439,15 @@ class BaseManager:
|
||||
:returns: Array of hash
|
||||
"""
|
||||
|
||||
try:
|
||||
files = os.listdir(self.get_images_directory())
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
files.sort()
|
||||
images = []
|
||||
for filename in files:
|
||||
if filename[0] != "." and not filename.endswith(".md5sum"):
|
||||
images.append({"filename": filename})
|
||||
img_dir = self.get_images_directory()
|
||||
for root, dirs, files in os.walk(img_dir):
|
||||
for filename in files:
|
||||
if filename[0] != "." and not filename.endswith(".md5sum"):
|
||||
path = os.path.relpath(os.path.join(root, filename), img_dir)
|
||||
images.append({
|
||||
"filename": filename,
|
||||
"path": path})
|
||||
return images
|
||||
|
||||
def get_images_directory(self):
|
||||
|
Reference in New Issue
Block a user