From 3a3adc7dee45b7918a3f0dce37d3880e2f102d4d Mon Sep 17 00:00:00 2001 From: sliptonic Date: Mon, 25 Jan 2021 11:18:43 -0600 Subject: [PATCH] fix bug when declining the creation of workdir subdirectories. --- .../Path/PathScripts/PathToolBitLibraryGui.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py index ea12f438b4..621ad0e996 100644 --- a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py +++ b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py @@ -89,11 +89,19 @@ def checkWorkingDir(): mode = 0o777 for dir in subdirlist: subdir = "{}{}{}".format(workingdir, os.path.sep, dir) - if not os.path.exists(subdir): - qm = PySide.QtGui.QMessageBox - ret = qm.question(None,'', "Toolbit Working directory {} should contain a '{}' subdirectory. Create it?".format(workingdir, dir), qm.Yes | qm.No) + if os.path.exists(subdir): + subdirlist.remove(dir) - if ret == qm.Yes: + if len(subdirlist) >= 1: + needed = ', '.join([str(d) for d in subdirlist]) + qm = PySide.QtGui.QMessageBox + ret = qm.question(None,'', "Toolbit Working directory {} needs these sudirectories:\n {} \n Create them?".format(workingdir, needed), qm.Yes | qm.No) + + if ret == qm.No: + return False + else: + for dir in subdirlist: + subdir = "{}{}{}".format(workingdir, os.path.sep, dir) os.mkdir(subdir, mode) if dir != 'Shape': qm = PySide.QtGui.QMessageBox