SplitRide overwrites existing file

Fixes #165.
This commit is contained in:
Mark Liversedge
2011-09-02 18:19:23 +01:00
parent 076190161f
commit 183564d1ea

View File

@@ -163,7 +163,11 @@ SplitRideDialog::CreateNewRideFile(const RideFile *ride, int nRecStart, int nRec
QFile file(filePath);
if (file.exists())
{
QMessageBox::critical(this, tr("Split Ride"), tr("The file %1 already exists and will not be overwritten").arg(filePath));
QString backupPath = filePath + ".bak";
QMessageBox::warning(this, tr("Split Ride"), tr("The file %1 already exists and will backed up to %2").arg(filePath).arg(backupPath));
QFile(backupPath).remove(); // just wipe away any previously saved backup
file.rename(backupPath);
return;
}