mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
Use QDir::exists() instead of QDir::setCurrent() to check for existence
Don't change into a directory just to see if it exists. Remove unnecessary braces of one of the changed if statements. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ed92b60bfe
commit
0a2e53caf2
4 changed files with 4 additions and 5 deletions
|
@ -1017,7 +1017,7 @@ QString DiveListView::lastUsedImageDir()
|
||||||
|
|
||||||
settings.beginGroup("FileDialog");
|
settings.beginGroup("FileDialog");
|
||||||
if (settings.contains("LastImageDir"))
|
if (settings.contains("LastImageDir"))
|
||||||
if (QDir::setCurrent(settings.value("LastImageDir").toString()))
|
if (QDir(settings.value("LastImageDir").toString()).exists())
|
||||||
lastImageDir = settings.value("LastImageDir").toString();
|
lastImageDir = settings.value("LastImageDir").toString();
|
||||||
return lastImageDir;
|
return lastImageDir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,9 +127,8 @@ void DiveLogExportDialog::on_buttonBox_accepted()
|
||||||
|
|
||||||
settings.beginGroup("FileDialog");
|
settings.beginGroup("FileDialog");
|
||||||
if (settings.contains("LastDir")) {
|
if (settings.contains("LastDir")) {
|
||||||
if (QDir::setCurrent(settings.value("LastDir").toString())) {
|
if (QDir(settings.value("LastDir").toString()).exists())
|
||||||
lastDir = settings.value("LastDir").toString();
|
lastDir = settings.value("LastDir").toString();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
|
|
@ -743,7 +743,7 @@ QString MainWindow::lastUsedDir()
|
||||||
|
|
||||||
settings.beginGroup("FileDialog");
|
settings.beginGroup("FileDialog");
|
||||||
if (settings.contains("LastDir"))
|
if (settings.contains("LastDir"))
|
||||||
if (QDir::setCurrent(settings.value("LastDir").toString()))
|
if (QDir(settings.value("LastDir").toString()).exists())
|
||||||
lastDir = settings.value("LastDir").toString();
|
lastDir = settings.value("LastDir").toString();
|
||||||
return lastDir;
|
return lastDir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ QString Smrtk2ssrfcWindow::lastUsedDir()
|
||||||
|
|
||||||
settings.beginGroup("FileDialog");
|
settings.beginGroup("FileDialog");
|
||||||
if (settings.contains("LastDir"))
|
if (settings.contains("LastDir"))
|
||||||
if (QDir::setCurrent(settings.value("LastDir").toString()))
|
if (QDir(settings.value("LastDir").toString()).exists())
|
||||||
lastDir = settings.value("LastDir").toString();
|
lastDir = settings.value("LastDir").toString();
|
||||||
return lastDir;
|
return lastDir;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue