Avoid crash when you broke your system permissions

Fix #877
This commit is contained in:
Julien Duponchelle 2017-01-27 10:56:48 +01:00
parent 267a5ae3a8
commit 2da20177a2
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -130,8 +130,11 @@ def images_directories(type):
paths = []
img_dir = os.path.expanduser(server_config.get("images_path", "~/GNS3/images"))
type_img_directory = default_images_directory(type)
try:
os.makedirs(type_img_directory, exist_ok=True)
paths.append(type_img_directory)
except (OSError, PermissionError):
pass
for directory in server_config.get("additional_images_path", "").split(";"):
paths.append(directory)
# Compatibility with old topologies we look in parent directory