Browse Source

fix idiotic path check

master
Nils 3 years ago
parent
commit
8e5f97aa86
  1. 7
      qtgui/projectname.py

7
qtgui/projectname.py

@ -75,7 +75,8 @@ class ProjectNameWidget(QtWidgets.QDialog):
if currentText.endswith("/"):
currentText = currentText[:-1]
path = pathlib.Path(api.sessionRoot(), currentText)
fullpath = pathlib.Path(api.sessionRoot(), currentText)
path = pathlib.Path(currentText)
errorMessage = ""
if currentText == "":
@ -84,9 +85,9 @@ class ProjectNameWidget(QtWidgets.QDialog):
errorMessage = QtCore.QCoreApplication.translate("ProjectNameWidget", "Name must be a relative path.")
elif pathlib.PurePosixPath(path).match("../*") or pathlib.PurePosixPath(path).match("*..*"):
errorMessage = QtCore.QCoreApplication.translate("ProjectNameWidget", "Moving to parent directory not allowed.")
elif "/" in currentText and path.parent.exists() and not os.access(path.parent, os.W_OK):
elif "/" in currentText and fullpath.parent.exists() and not os.access(fullpath.parent, os.W_OK):
errorMessage = QtCore.QCoreApplication.translate("ProjectNameWidget", "Writing in this directory is not permitted.")
elif path.exists():
elif fullpath.exists():
errorMessage = QtCore.QCoreApplication.translate("ProjectNameWidget", "Name is already in use.")
ok = self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Ok)

Loading…
Cancel
Save