From dd29b9730e379541e75a870ed3c510a86c8dd7de Mon Sep 17 00:00:00 2001 From: Marc Sabatella Date: Wed, 2 Dec 2015 09:23:58 -0700 Subject: [PATCH] fix #88746: unable to save files --- libmscore/scorefile.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libmscore/scorefile.cpp b/libmscore/scorefile.cpp index f96bcc4a8f9e4..06b7bef2f14de 100644 --- a/libmscore/scorefile.cpp +++ b/libmscore/scorefile.cpp @@ -385,6 +385,7 @@ bool Score::saveFile() temp.close(); QString name(info.filePath()); + QDir dir(info.path()); if (!saved()) { // if file was already saved in this session // save but don't overwrite backup again @@ -393,7 +394,6 @@ bool Score::saveFile() // step 2 // remove old backup file if exists // - QDir dir(info.path()); QString backupName = QString(".") + info.fileName() + QString(","); if (dir.exists(backupName)) { if (!dir.remove(backupName)) { @@ -421,6 +421,17 @@ bool Score::saveFile() SetFileAttributes((LPCTSTR)backupNativePath.toLocal8Bit(), FILE_ATTRIBUTE_HIDDEN); #endif } + else { + // file has previously been saved - remove the old file + if (dir.exists(name)) { + if (!dir.remove(name)) { +// if (!MScore::noGui) +// QMessageBox::critical(0, tr("MuseScore: Save File"), +// tr("Removing old file") + name + tr(" failed")); + } + } + } + // // step 4 // rename temp name into file name