From 2f12c7f6501b516ad11acf9f077a8bee8cab72cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 2 Feb 2023 12:47:15 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20method=20to=20check=20for=20e?= =?UTF-8?q?xistance=20of=20base=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/settings/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/octoprint/settings/__init__.py b/src/octoprint/settings/__init__.py index 96e4829d0..ad9cb51ca 100644 --- a/src/octoprint/settings/__init__.py +++ b/src/octoprint/settings/__init__.py @@ -1766,6 +1766,19 @@ class Settings: return value.lower() in valid_boolean_trues return value is not None + def checkBaseFolder(self, type): + if type != "base" and type not in default_settings["folder"]: + return False + + if type == "base": + return os.path.exists(self._basedir) + + folder = self.get(["folder", type]) + default_folder = self._get_default_folder(type) + if folder is None: + folder = default_folder + return os.path.exists(folder) + def getBaseFolder( self, type,