From c6704b1323175f28b621ec8ce2f1278b86a16683 Mon Sep 17 00:00:00 2001 From: spycrab Date: Tue, 5 Jun 2018 13:19:44 +0200 Subject: [PATCH] Qt/MainWindow: Remember last directory in "Open" prompt --- Source/Core/DolphinQt2/MainWindow.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index d334806cf1..39a50e72f0 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -527,10 +527,20 @@ void MainWindow::RefreshGameList() QString MainWindow::PromptFileName() { - return QFileDialog::getOpenFileName( - this, tr("Select a File"), QDir::currentPath(), + auto& settings = Settings::Instance().GetQSettings(); + QString path = QFileDialog::getOpenFileName( + this, tr("Select a File"), + settings.value(QStringLiteral("mainwindow/lastdir"), QStringLiteral("")).toString(), tr("All GC/Wii files (*.elf *.dol *.gcm *.iso *.tgc *.wbfs *.ciso *.gcz *.wad);;" "All Files (*)")); + + if (!path.isEmpty()) + { + settings.setValue(QStringLiteral("mainwindow/lastdir"), + QFileInfo(path).absoluteDir().absolutePath()); + } + + return path; } void MainWindow::ChangeDisc()