1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Back up old config file before upgrading, when it's an ini file

This commit is contained in:
Leo Franchi 2012-03-09 15:16:16 -05:00
parent dc28a7694b
commit 2710bca395

View File

@ -60,8 +60,22 @@ TomahawkSettings::TomahawkSettings( QObject* parent )
{
qDebug() << "Config version outdated, old:" << value( "configversion" ).toUInt()
<< "new:" << TOMAHAWK_SETTINGS_VERSION
<< "Doing upgrade, if any...";
<< "Doing upgrade, if any, and backing up";
// QString newname = QString( "%1.v%2" ).arg( dbname ).arg( version );
if ( format() == IniFormat ||
( format() == NativeFormat
#ifdef Q_OS_WIN
&& false
#endif
) )
{
qDebug() << "Backing up old ini-style config file";
const QString path = fileName();
const QString newname = path + QString( ".v%1" ).arg( value( "configversion" ).toString() );
QFile::copy( path, newname );
}
int current = value( "configversion" ).toUInt();
while ( current < TOMAHAWK_SETTINGS_VERSION )
{