Skip to content

Commit d892b77

Browse files
authored
Merge pull request #3766 from fluoriteByte/master
Add XDG Config Home support
2 parents bb5bfee + 07a8657 commit d892b77

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

gns3/dialogs/profile_select.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def __init__(self, parent=None):
5353
if sys.platform.startswith("win"):
5454
appdata = os.path.expandvars("%APPDATA%")
5555
path = os.path.join(appdata, "GNS3", version)
56+
elif os.path.expandvars("$XDG_CONFIG_HOME"):
57+
xdg_config = os.path.expandvars("$XDG_CONFIG_HOME")
58+
path = os.path.join(xdg_config, "GNS3", version)
5659
else:
5760
home = os.path.expanduser("~")
5861
path = os.path.join(home, ".config", "GNS3", version)

gns3/local_config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def _resetLoadConfig(self):
9292

9393
if sys.platform.startswith("win"):
9494
old_config_path = os.path.join(os.path.expandvars("%APPDATA%"), "GNS3", filename)
95+
elif os.path.expandvars("$XDG_CONFIG_HOME"):
96+
xdg_config = os.path.expandvars("$XDG_CONFIG_HOME")
97+
old_config_path = os.path.join(xdg_config, "GNS3", filename)
9598
else:
9699
old_config_path = os.path.join(os.path.expanduser("~"), ".config", "GNS3", filename)
97100

@@ -142,6 +145,9 @@ def configDirectory(self):
142145
if sys.platform.startswith("win"):
143146
appdata = os.path.expandvars("%APPDATA%")
144147
path = os.path.join(appdata, "GNS3", version)
148+
elif os.path.expandvars("$XDG_CONFIG_HOME"):
149+
xdg_config = os.path.expandvars("$XDG_CONFIG_HOME")
150+
path = os.path.join(xdg_config, "GNS3", version)
145151
else:
146152
home = os.path.expanduser("~")
147153
path = os.path.join(home, ".config", "GNS3", version)

0 commit comments

Comments
 (0)