Improve config file search (#440)

This commit is contained in:
Alfredo Monclus 2022-01-13 13:08:12 -03:00 committed by GitHub
parent e1e3437d62
commit 6b043d63bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -242,7 +242,12 @@ class KlipperScreenConfig:
if not path.exists(file):
file = os.path.join(klipperscreendir, self.configfile_name)
if not path.exists(file):
file = os.path.expanduser("~/") + "klipper_config/%s" % (self.configfile_name)
file = self.configfile_name.lower()
if not path.exists(file):
klipper_config = os.path.join(os.path.expanduser("~/"), "klipper_config")
file = os.path.join(klipper_config, self.configfile_name)
if not path.exists(file):
file = os.path.join(klipper_config, self.configfile_name.lower())
if not path.exists(file):
file = self.default_config_path
@ -356,10 +361,11 @@ class KlipperScreenConfig:
path = self.config_path
else:
path = os.path.expanduser("~/")
if os.path.exists(path+"klipper_config/"):
path = path + "klipper_config/KlipperScreen.conf"
klipper_config = os.path.join(path, "klipper_config")
if os.path.exists(klipper_config):
path = os.path.join(klipper_config, "KlipperScreen.conf")
else:
path = path + "KlipperScreen.conf"
path = os.path.join(path, "KlipperScreen.conf")
try:
file = open(path, 'w')