mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-05-17 00:46:01 +03:00
Add XDG Config Home support
This commit is contained in:
@@ -53,6 +53,9 @@ class ProfileSelectDialog(QtWidgets.QDialog, Ui_ProfileSelectDialog):
|
||||
if sys.platform.startswith("win"):
|
||||
appdata = os.path.expandvars("%APPDATA%")
|
||||
path = os.path.join(appdata, "GNS3", version)
|
||||
elif os.path.expandvars("$XDG_CONFIG_HOME"):
|
||||
xdg_config = os.path.expandvars("$XDG_CONFIG_HOME")
|
||||
path = os.path.join(xdg_config, "GNS3", version)
|
||||
else:
|
||||
home = os.path.expanduser("~")
|
||||
path = os.path.join(home, ".config", "GNS3", version)
|
||||
|
||||
@@ -92,6 +92,9 @@ class LocalConfig(QtCore.QObject):
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
old_config_path = os.path.join(os.path.expandvars("%APPDATA%"), "GNS3", filename)
|
||||
elif os.path.expandvars("$XDG_CONFIG_HOME"):
|
||||
xdg_config = os.path.expandvars("$XDG_CONFIG_HOME")
|
||||
old_config_path = os.path.join(xdg_config, "GNS3", filename)
|
||||
else:
|
||||
old_config_path = os.path.join(os.path.expanduser("~"), ".config", "GNS3", filename)
|
||||
|
||||
@@ -142,6 +145,9 @@ class LocalConfig(QtCore.QObject):
|
||||
if sys.platform.startswith("win"):
|
||||
appdata = os.path.expandvars("%APPDATA%")
|
||||
path = os.path.join(appdata, "GNS3", version)
|
||||
elif os.path.expandvars("$XDG_CONFIG_HOME"):
|
||||
xdg_config = os.path.expandvars("$XDG_CONFIG_HOME")
|
||||
path = os.path.join(xdg_config, "GNS3", version)
|
||||
else:
|
||||
home = os.path.expanduser("~")
|
||||
path = os.path.join(home, ".config", "GNS3", version)
|
||||
|
||||
Reference in New Issue
Block a user