david_ac adding a commandline parameter for the data dir, as requested by svenstaro
--- a/QTfrontend/main.cpp Thu May 07 23:57:39 2009 +0000
+++ b/QTfrontend/main.cpp Fri May 08 01:49:11 2009 +0000
@@ -21,6 +21,8 @@
#include <QLocale>
#include <QMessageBox>
#include <QPlastiqueStyle>
+#include <QRegExp>
+#include <QMap>
#include "hwform.h"
#include "hwconsts.h"
@@ -44,6 +46,29 @@
{
QApplication app(argc, argv);
+ QStringList arguments = app.arguments();
+ QMap<QString, QString> parsedArgs;
+ {
+ QList<QString>::iterator i = arguments.begin();
+ while(++i != arguments.end()) {
+ QString arg = *i;
+
+ QRegExp opt("--(\\S+)=(.+)");
+ if(opt.exactMatch(arg)) {
+ parsedArgs[opt.cap(1)] = opt.cap(2);
+ arguments.erase(i);
+ }
+ }
+ }
+
+ if(parsedArgs.contains("data-dir")) {
+ QFileInfo f(parsedArgs["data-dir"]);
+ if(!f.exists()) {
+ qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath();
+ }
+ *cDataDir = f.absoluteFilePath();
+ }
+
app.setStyle(new QPlastiqueStyle);
QDateTime now = QDateTime::currentDateTime();