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(); temp.close();
QString name(info.filePath()); QString name(info.filePath());
QDir dir(info.path());
if (!saved()) { if (!saved()) {
// if file was already saved in this session // if file was already saved in this session
// save but don't overwrite backup again // save but don't overwrite backup again
@ -393,7 +394,6 @@ bool Score::saveFile()
// step 2 // step 2
// remove old backup file if exists // remove old backup file if exists
// //
QDir dir(info.path());
QString backupName = QString(".") + info.fileName() + QString(","); QString backupName = QString(".") + info.fileName() + QString(",");
if (dir.exists(backupName)) { if (dir.exists(backupName)) {
if (!dir.remove(backupName)) { if (!dir.remove(backupName)) {
@ -421,6 +421,17 @@ bool Score::saveFile()
SetFileAttributes((LPCTSTR)backupNativePath.toLocal8Bit(), FILE_ATTRIBUTE_HIDDEN); SetFileAttributes((LPCTSTR)backupNativePath.toLocal8Bit(), FILE_ATTRIBUTE_HIDDEN);
#endif #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 // step 4
// rename temp name into file name // rename temp name into file name