From 1e787b4d22f523bfc18a687dff5749a6ba7bd900 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Wed, 11 Jun 2014 21:01:06 +0200 Subject: [PATCH] sqbpro: Allow relative database file paths When the path to the database file given in a project file doesn't exist try parsing it relative to the path of the loaded project file. This makes it possible to move project and database file around together without need to manually correct the path in the project file. See #36. --- src/MainWindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 41e37c1c..e60b367a 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1720,7 +1720,10 @@ bool MainWindow::loadProject(QString filename) if(xml.name() == "db") { // DB file - fileOpen(xml.attributes().value("path").toString()); + QString dbfilename = xml.attributes().value("path").toString(); + if(!QFile::exists(dbfilename)) + dbfilename = QFileInfo(filename).absolutePath() + QDir::separator() + dbfilename; + fileOpen(dbfilename); ui->dbTreeWidget->collapseAll(); } else if(xml.name() == "window") { // Window settings