Only return the path if the folder actually exist

It seems that the dialog is acting up if the last known folder doesn't
exist anymore (usually when a network drive was unmounted).
This commit is contained in:
Jaime van Kessel 2021-09-20 15:43:04 +02:00
parent 11b1998156
commit ee96080540

View File

@ -750,7 +750,9 @@ class CuraApplication(QtApplication):
@pyqtSlot(str, result = QUrl) @pyqtSlot(str, result = QUrl)
def getDefaultPath(self, key): def getDefaultPath(self, key):
default_path = self.getPreferences().getValue("local_file/%s" % key) default_path = self.getPreferences().getValue("local_file/%s" % key)
return QUrl.fromLocalFile(default_path) if os.path.exists(default_path):
return QUrl.fromLocalFile(default_path)
return QUrl()
@pyqtSlot(str, str) @pyqtSlot(str, str)
def setDefaultPath(self, key, default_path): def setDefaultPath(self, key, default_path):