--- a/QTfrontend/main.cpp Mon Oct 12 13:56:07 2009 +0000
+++ b/QTfrontend/main.cpp Mon Oct 12 16:44:30 2009 +0000
@@ -75,11 +75,15 @@
*cDataDir = f.absoluteFilePath();
}
+ if(parsedArgs.contains("config-dir")) {
+ QFileInfo f(parsedArgs["config-dir"]);
+ *cConfigDir = f.absoluteFilePath();
+ }
+
app.setStyle(new QPlastiqueStyle);
QDateTime now = QDateTime::currentDateTime();
- QDateTime zero;
- srand(now.secsTo(zero));
+ srand(now.toTime_t());
rand();
Q_INIT_RESOURCE(hedgewars);
@@ -288,23 +292,37 @@
bindir->cd("bin"); // workaround over NSIS installer
- cfgdir->setPath(cfgdir->homePath());
-
+ if(cConfigDir->length() == 0)
+ cfgdir->setPath(cfgdir->homePath());
+ else
+ cfgdir->setPath(*cConfigDir);
+
+ if(cConfigDir->length() == 0)
+ {
#ifdef __APPLE__
- if (checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars"))
- {
- checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Demos");
- checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Saves");
+ if (checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars"))
+ {
+ checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Demos");
+ checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Saves");
+ }
+ cfgdir->cd("Library/Application Support/Hedgewars");
+#else
+ if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
+ {
+ checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
+ checkForDir(cfgdir->absolutePath() + "/.hedgewars/Saves");
+ }
+ cfgdir->cd(".hedgewars");
+#endif
}
- cfgdir->cd("Library/Application Support/Hedgewars");
-#else
- if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
+ else
{
- checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
- checkForDir(cfgdir->absolutePath() + "/.hedgewars/Saves");
+ if (checkForDir(cfgdir->absolutePath()))
+ {
+ checkForDir(cfgdir->absolutePath() + "/Demos");
+ checkForDir(cfgdir->absolutePath() + "/Saves");
+ }
}
- cfgdir->cd(".hedgewars");
-#endif
datadir->cd(bindir->absolutePath());
datadir->cd(*cDataDir);