Skip to content

Commit

Permalink
Merge pull request #2305 from MarcSabatella/88746-save-fail
Browse files Browse the repository at this point in the history
fix #88746: unable to save files
  • Loading branch information
MarcSabatella committed Dec 2, 2015
2 parents 7321ba6 + dd29b97 commit 77e980d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion libmscore/scorefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 77e980d

Please sign in to comment.