This should fix config file migration for the mac.
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 22 Jan 2009 19:35:12 +0000 (20:35 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 22 Jan 2009 19:35:12 +0000 (20:35 +0100)
Please test though, maybe I've run into #ifdef hell again :)

src/core/core.cpp
src/qtui/qtuiapplication.cpp

index 1e1bb61..9c92faf 100644 (file)
@@ -55,18 +55,21 @@ Core::Core() : storage(0) {
 
   loadTranslation(QLocale::system());
 
-#ifndef Q_WS_MAC
-
   // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
   // Move settings, note this does not delete the old files
-#ifdef Q_WS_WIN
-  QSettings::Format format = QSettings::IniFormat;
+#ifdef Q_WS_MAC
+    QSettings newSettings("quassel-irc.org", "quasselcore");
 #else
-  QSettings::Format format = QSettings::NativeFormat;
-#endif
-  QString newFilePath = Quassel::configDirPath() + "quasselcore"
-  + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
-  QSettings newSettings(newFilePath, format);
+
+# ifdef Q_WS_WIN
+    QSettings::Format format = QSettings::IniFormat;
+# else
+    QSettings::Format format = QSettings::NativeFormat;
+# endif
+    QString newFilePath = Quassel::configDirPath() + "quasselcore"
+    + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
+    QSettings newSettings(newFilePath, format);
+#endif /* Q_WS_MAC */
 
   if(newSettings.value("Config/Version").toUInt() != 1) {
     qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your core settings...";
@@ -82,6 +85,7 @@ Core::Core() : storage(0) {
       newSettings.setValue("Config/Version", 1);
       qWarning() << "*   Your core settings have been migrated to" << newFilePath;
 
+#ifndef Q_WS_MAC /* we don't need to move the db and cert for mac */
 #ifdef Q_OS_WIN32
       QString quasselDir = qgetenv("APPDATA") + "/quassel/";
 #elif defined Q_WS_MAC
index 49eecee..0c7f922 100644 (file)
@@ -64,17 +64,22 @@ QtUiApplication::QtUiApplication(int &argc, char **argv)
 bool QtUiApplication::init() {
   if(Quassel::init()) {
 
-#ifndef Q_WS_MAC
     // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
     // Move settings, note this does not delete the old files
-#ifdef Q_WS_WIN
-    QSettings::Format format = QSettings::IniFormat;
+#ifdef Q_WS_MAC
+    QSettings newSettings("quassel-irc.org", "quasselclient");
 #else
+
+# ifdef Q_WS_WIN
+    QSettings::Format format = QSettings::IniFormat;
+# else
     QSettings::Format format = QSettings::NativeFormat;
-#endif
+# endif
+
     QString newFilePath = Quassel::configDirPath() + "quasselclient"
     + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
     QSettings newSettings(newFilePath, format);
+#endif /* Q_WS_MAC */
 
     if(newSettings.value("Config/Version").toUInt() != 1) {
       qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your client settings...";
@@ -92,7 +97,7 @@ bool QtUiApplication::init() {
       }
       qWarning() << "*** Migration completed.\n\n";
     }
-#endif /* !Q_WS_MAC */
+
     // MIGRATION end
 
     // session resume