From 5a33bb4d24d4e571ce43cf082fde383fcbdd6b71 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:50:11 +0100 Subject: [PATCH] Arch: Arch_Window.py: do isdir and isfile check for librarypath --- src/Mod/Arch/ArchWindow.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index b0df4623b7..f27a6c9eab 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -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])