mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
6 files changed
+105
-6
No files matched your search
@@ -27,6 +27,27 @@ import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def scan_for_images(type):
|
||||
"""
|
||||
Scan directories for available image for a type
|
||||
|
||||
:param type: emulator type (dynamips, qemu, iou)
|
||||
"""
|
||||
files = set()
|
||||
paths = []
|
||||
for directory in images_directories(type):
|
||||
for root, _, filenames in os.walk(directory):
|
||||
for file in filenames:
|
||||
path = os.path.join(root, file)
|
||||
if file not in files:
|
||||
if (file.endswith(".image") and type == "dynamips") \
|
||||
or (file.endswith(".bin") and type == "iou") \
|
||||
or (not file.endswith(".bin") and not file.endswith(".image") and type == "qemu"):
|
||||
files.add(file)
|
||||
paths.append(path)
|
||||
return paths
|
||||
|
||||
|
||||
def images_directories(type):
|
||||
"""
|
||||
Return all directory where we will look for images
|
||||
|
||||
Reference in new issue
Block a user