Improve config file search (#440)
This commit is contained in:
parent
e1e3437d62
commit
6b043d63bc
@ -242,9 +242,14 @@ class KlipperScreenConfig:
|
|||||||
if not path.exists(file):
|
if not path.exists(file):
|
||||||
file = os.path.join(klipperscreendir, self.configfile_name)
|
file = os.path.join(klipperscreendir, self.configfile_name)
|
||||||
if not path.exists(file):
|
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):
|
if not path.exists(file):
|
||||||
file = self.default_config_path
|
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
|
||||||
|
|
||||||
logging.info("Found configuration file at: %s" % file)
|
logging.info("Found configuration file at: %s" % file)
|
||||||
return file
|
return file
|
||||||
@ -356,10 +361,11 @@ class KlipperScreenConfig:
|
|||||||
path = self.config_path
|
path = self.config_path
|
||||||
else:
|
else:
|
||||||
path = os.path.expanduser("~/")
|
path = os.path.expanduser("~/")
|
||||||
if os.path.exists(path+"klipper_config/"):
|
klipper_config = os.path.join(path, "klipper_config")
|
||||||
path = path + "klipper_config/KlipperScreen.conf"
|
if os.path.exists(klipper_config):
|
||||||
|
path = os.path.join(klipper_config, "KlipperScreen.conf")
|
||||||
else:
|
else:
|
||||||
path = path + "KlipperScreen.conf"
|
path = os.path.join(path, "KlipperScreen.conf")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
file = open(path, 'w')
|
file = open(path, 'w')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user