Skip to content

Commit 77e980d

Browse files
committed
Merge pull request #2305 from MarcSabatella/88746-save-fail
fix #88746: unable to save files
2 parents 7321ba6 + dd29b97 commit 77e980d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

libmscore/scorefile.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ bool Score::saveFile()
385385
temp.close();
386386

387387
QString name(info.filePath());
388+
QDir dir(info.path());
388389
if (!saved()) {
389390
// if file was already saved in this session
390391
// save but don't overwrite backup again
@@ -393,7 +394,6 @@ bool Score::saveFile()
393394
// step 2
394395
// remove old backup file if exists
395396
//
396-
QDir dir(info.path());
397397
QString backupName = QString(".") + info.fileName() + QString(",");
398398
if (dir.exists(backupName)) {
399399
if (!dir.remove(backupName)) {
@@ -421,6 +421,17 @@ bool Score::saveFile()
421421
SetFileAttributes((LPCTSTR)backupNativePath.toLocal8Bit(), FILE_ATTRIBUTE_HIDDEN);
422422
#endif
423423
}
424+
else {
425+
// file has previously been saved - remove the old file
426+
if (dir.exists(name)) {
427+
if (!dir.remove(name)) {
428+
// if (!MScore::noGui)
429+
// QMessageBox::critical(0, tr("MuseScore: Save File"),
430+
// tr("Removing old file") + name + tr(" failed"));
431+
}
432+
}
433+
}
434+
424435
//
425436
// step 4
426437
// rename temp name into file name

0 commit comments

Comments
 (0)