Skip to content

Commit

Permalink
Qt/MainWindow: Remember last directory in "Open" prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
spycrab committed Jun 5, 2018
1 parent 8675fa0 commit c6704b1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Source/Core/DolphinQt2/MainWindow.cpp
Expand Up @@ -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()
Expand Down

0 comments on commit c6704b1

Please sign in to comment.