data dir initial check (test for wrong installation)
authordisplacer
Sat, 25 Nov 2006 11:56:37 +0000
changeset 274 94bd2577ebbb
parent 273 3cc5b4dd6770
child 275 7cb230cd2b1d
data dir initial check (test for wrong installation)
QTfrontend/main.cpp.in
--- a/QTfrontend/main.cpp.in	Sat Nov 25 10:43:54 2006 +0000
+++ b/QTfrontend/main.cpp.in	Sat Nov 25 11:56:37 2006 +0000
@@ -72,7 +72,13 @@
 	cfgdir->cd(".hedgewars");
 
 	datadir = new QDir("${HEDGEWARS_DATADIR}");
-	datadir->cd("hedgewars/Data");
+	if(!datadir->cd("hedgewars/Data")) {
+		QMessageBox::critical(0, QMessageBox::tr("Error"), 
+			QMessageBox::tr("Failed to open data directory:\n%1\n"
+					"Please check your installation").
+					arg(datadir->absolutePath()+"/hedgewars/Data"));
+		return 1;
+	}
 
 	HWForm *Form = new HWForm();
 	Form->show();