Skip to content

Commit fe09e5a

Browse files
committed
Check if last folder url exists
1 parent 49a2c9b commit fe09e5a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

application/systemfiledialog.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "systemfiledialog.h"
22

3+
#include <QFileInfo>
34
#include <QFileDialog>
45
#include <QStandardPaths>
56

@@ -84,7 +85,12 @@ void SystemFileDialog::onFileDialogFinished()
8485
QUrl SystemFileDialog::standardLocationPath(StandardLocation location)
8586
{
8687
if(location == LastLocation) {
87-
return globalPrefs->lastFolderUrl();
88+
const auto lastFolderUrl = globalPrefs->lastFolderUrl();
89+
if(!QFileInfo::exists(lastFolderUrl.toLocalFile())) {
90+
return QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
91+
} else {
92+
return lastFolderUrl;
93+
}
8894
} else if(location == HomeLocation) {
8995
return QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
9096
} else if(location == DownloadsLocation) {

0 commit comments

Comments
 (0)