Merge pull request #6345 from Roy-043/Arch-Arch_Window.py-do-isdir-and-isfile-check-for-librarypath
Arch: Arch_Window.py: do isdir and isfile check for librarypath
This commit is contained in:
@@ -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])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user