Skip to content

Commit

Permalink
Normalize path (slashes to be precise) when opening a database or sav…
Browse files Browse the repository at this point in the history
…ing the last used database paths (keepassxreboot#7864)

Fixes keepassxreboot#7821
  • Loading branch information
HusseinKabbout authored Apr 12, 2022
1 parent 5916a8f commit 692c95b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <QCloseEvent>
#include <QDesktopServices>
#include <QDir>
#include <QFileInfo>
#include <QList>
#include <QMimeData>
Expand Down Expand Up @@ -1388,7 +1389,7 @@ bool MainWindow::saveLastDatabases()
QStringList openDatabases;
for (int i = 0; i < m_ui->tabWidget->count(); ++i) {
auto dbWidget = m_ui->tabWidget->databaseWidgetFromIndex(i);
openDatabases.append(dbWidget->database()->filePath());
openDatabases.append(QDir::toNativeSeparators(dbWidget->database()->filePath()));
}

config()->set(Config::LastOpenedDatabases, openDatabases);
Expand Down
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include <QCommandLineParser>
#include <QDir>
#include <QFile>
#include <QWindow>

Expand Down Expand Up @@ -180,7 +181,7 @@ int main(int argc, char** argv)
}

if (!filename.isEmpty() && QFile::exists(filename) && !filename.endsWith(".json", Qt::CaseInsensitive)) {
mainWindow.openDatabase(filename, password, parser.value(keyfileOption));
mainWindow.openDatabase(QDir::toNativeSeparators(filename), password, parser.value(keyfileOption));
}
}

Expand Down

0 comments on commit 692c95b

Please sign in to comment.