From 8cefceaf9985ad284130f7670d228f0da3ca2f34 Mon Sep 17 00:00:00 2001 From: Heewa Barfchin Date: Mon, 10 May 2021 13:24:17 -0400 Subject: [PATCH] Start: fix bug when custom dir missing --- src/Mod/Start/StartPage/StartPage.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index 20589363bf..89a30e4e4f 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -415,15 +415,18 @@ def handle(): for cfolder in cfolders.split(";;"): # allow several paths separated by ;; if not os.path.isdir(cfolder): cfolder = os.path.dirname(cfolder) - SECTION_CUSTOM += encode("

"+os.path.basename(os.path.normpath(cfolder))+"

") - SECTION_CUSTOM += "" - # hide the custom section tooltip if custom section is set (users know about it if they enabled it) - HTML = HTML.replace("id=\"customtip\"","id=\"customtip\" style=\"display:none;\"") - dn += 1 + if not os.path.exists(cfolder): + FreeCAD.Console.PrintWarning("Custom folder not found: %s" % cfolder) + else: + SECTION_CUSTOM += encode("

"+os.path.basename(os.path.normpath(cfolder))+"

") + SECTION_CUSTOM += "" + # hide the custom section tooltip if custom section is set (users know about it if they enabled it) + HTML = HTML.replace("id=\"customtip\"","id=\"customtip\" style=\"display:none;\"") + dn += 1 HTML = HTML.replace("SECTION_CUSTOM",SECTION_CUSTOM) # build IMAGE_SRC paths