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.
This commit is contained in:
Martin Kleusberg
2014-06-11 21:01:06 +02:00
parent daf12d413c
commit 1e787b4d22

View File

@@ -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