fix #88746: unable to save files

This commit is contained in:
Marc Sabatella 2015-12-02 09:23:58 -07:00
parent 7321ba6588
commit dd29b9730e

View file

@ -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