Arch: Arch_Window.py: do isdir and isfile check for librarypath

This commit is contained in:
Roy-043
2022-02-11 19:50:11 +01:00
committed by GitHub
parent 09a05a9cd0
commit 5a33bb4d24

View File

@@ -383,15 +383,16 @@ class _CommandWindow:
librarypath = librarypath.replace("\\", "/") + "/Architectural Parts"
presetdir = FreeCAD.getUserAppDataDir().replace("\\", "/") + "/Arch"
for path in [librarypath, presetdir]:
if os.path.exists(path):
if os.path.isdir(path):
for wtype in ["Windows", "Doors"]:
wdir = path + "/" + wtype
if os.path.exists(wdir):
if os.path.isdir(wdir):
for subtype in os.listdir(wdir):
subdir = wdir + "/" + subtype
if os.path.exists(subdir):
if os.path.isdir(subdir):
for subfile in os.listdir(subdir):
if subfile.lower().endswith(".fcstd"):
if (os.path.isfile(subdir + "/" + subfile)
and subfile.lower().endswith(".fcstd")):
self.librarypresets.append([wtype + " - " + subtype + " - " + subfile[:-6],
subdir + "/" + subfile])