Better handle project names (#2603)

This commit is contained in:
Itay Cohen 2021-02-28 16:51:08 +02:00 committed by GitHub
parent de234e600e
commit 6cbf0c0cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -700,11 +700,16 @@ RzProjectErr MainWindow::saveProject(bool *canceled)
RzProjectErr MainWindow::saveProjectAs(bool *canceled) RzProjectErr MainWindow::saveProjectAs(bool *canceled)
{ {
QString dir = core->getConfig("prj.file"); QString projectFile = core->getConfig("prj.file");
if (dir.isEmpty()) { if (projectFile.isEmpty()) {
dir = QDir(filename).dirName(); // preferred name is of fromat 'binary.exe.rzdb'
projectFile = QString("%1.%2").arg(filename).arg("rzdb");
} }
QString file = QFileDialog::getSaveFileName(this, tr("Save Project"), dir, PROJECT_FILE_FILTER);
QFileDialog fileDialog(this);
// Append 'rzdb' suffix if it does not exist
fileDialog.setDefaultSuffix("rzdb");
QString file = fileDialog.getSaveFileName(this, tr("Save Project"), projectFile, PROJECT_FILE_FILTER);
if (file.isEmpty()) { if (file.isEmpty()) {
if (canceled) { if (canceled) {
*canceled = true; *canceled = true;