Fix issue preventing to use custom nested symbols. Fixes #1969

pull/1971/head
grossmj 3 years ago
parent e026c1e91f
commit 6f1feed265

@ -25,6 +25,7 @@ import os
from .compute import ComputeConflict, ComputeError
from .ports.port_factory import PortFactory, StandardPortFactory, DynamipsPortFactory
from ..utils.images import images_directories
from ..config import Config
from ..utils.qt import qt_font_to_style
@ -263,10 +264,12 @@ class Node:
if val is None:
val = ":/symbols/computer.svg"
# No abs path, fix them (bug of 1.X)
try:
if not val.startswith(":") and os.path.abspath(val):
val = os.path.basename(val)
if not val.startswith(":") and os.path.isabs(val):
server_config = Config.instance().get_section_config("Server")
default_symbol_directory = os.path.expanduser(server_config.get("images_path", "~/GNS3/symbols"))
if os.path.commonprefix([default_symbol_directory, val]) != default_symbol_directory:
val = os.path.basename(val)
except OSError:
pass

Loading…
Cancel
Save