Start: fix bug when custom dir missing
This commit is contained in:
@@ -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("<h2>"+os.path.basename(os.path.normpath(cfolder))+"</h2>")
|
||||
SECTION_CUSTOM += "<ul>"
|
||||
for basename in os.listdir(cfolder):
|
||||
filename = os.path.join(cfolder,basename)
|
||||
SECTION_CUSTOM += encode(buildCard(filename,method="LoadCustom.py?filename="+str(dn)+"_"))
|
||||
SECTION_CUSTOM += "</ul>"
|
||||
# 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("<h2>"+os.path.basename(os.path.normpath(cfolder))+"</h2>")
|
||||
SECTION_CUSTOM += "<ul>"
|
||||
for basename in os.listdir(cfolder):
|
||||
filename = os.path.join(cfolder,basename)
|
||||
SECTION_CUSTOM += encode(buildCard(filename,method="LoadCustom.py?filename="+str(dn)+"_"))
|
||||
SECTION_CUSTOM += "</ul>"
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user