--- 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);