Skip to content

Commit

Permalink
Better handle project names (#2603)
Browse files Browse the repository at this point in the history
  • Loading branch information
ITAYC0HEN authored Feb 28, 2021
1 parent de234e6 commit 6cbf0c0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/core/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,11 +700,16 @@ RzProjectErr MainWindow::saveProject(bool *canceled)

RzProjectErr MainWindow::saveProjectAs(bool *canceled)
{
QString dir = core->getConfig("prj.file");
if (dir.isEmpty()) {
dir = QDir(filename).dirName();
QString projectFile = core->getConfig("prj.file");
if (projectFile.isEmpty()) {
// 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 (canceled) {
*canceled = true;
Expand Down

0 comments on commit 6cbf0c0

Please sign in to comment.