QTfrontend/main.cpp
changeset 8206 1633a6510834
parent 8187 fa725fe25708
child 8223 14d9a3c33650
--- a/QTfrontend/main.cpp	Mon Dec 03 18:08:19 2012 +0100
+++ b/QTfrontend/main.cpp	Mon Dec 03 23:54:12 2012 +0400
@@ -90,9 +90,9 @@
 
 bool checkForDir(const QString & dir)
 {
-    QDir tmpdir;
-    if (!tmpdir.exists(dir))
-        if (!tmpdir.mkdir(dir))
+    QDir tmpdir(dir);
+    if (!tmpdir.exists())
+        if (!tmpdir.mkpath(dir))
         {
             QMessageBox directoryMsg(QApplication::activeWindow());
             directoryMsg.setIcon(QMessageBox::Warning);
@@ -105,6 +105,15 @@
     return true;
 }
 
+bool checkForFile(const QString & file)
+{
+    QFile tmpfile(file);
+    if (!tmpfile.exists())
+        return tmpfile.open(QFile::WriteOnly);
+    else
+        return true;
+}
+
 #ifdef __APPLE__
 static CocoaInitializer *cocoaInit = NULL;
 // Function to be called at end of program's termination on OS X to release
@@ -252,6 +261,8 @@
     engine.setWriteDir(cfgdir->absolutePath());
     engine.mountPacks();
 
+    checkForFile("physfs://hedgewars.ini");
+
     QTranslator Translator;
     {
         QSettings settings("physfs://hedgewars.ini", QSettings::IniFormat);