QTfrontend/main.cpp
changeset 8206 1633a6510834
parent 8187 fa725fe25708
child 8223 14d9a3c33650
equal deleted inserted replaced
8205:921e63507bea 8206:1633a6510834
    88         season = SEASON_NONE;
    88         season = SEASON_NONE;
    89 }
    89 }
    90 
    90 
    91 bool checkForDir(const QString & dir)
    91 bool checkForDir(const QString & dir)
    92 {
    92 {
    93     QDir tmpdir;
    93     QDir tmpdir(dir);
    94     if (!tmpdir.exists(dir))
    94     if (!tmpdir.exists())
    95         if (!tmpdir.mkdir(dir))
    95         if (!tmpdir.mkpath(dir))
    96         {
    96         {
    97             QMessageBox directoryMsg(QApplication::activeWindow());
    97             QMessageBox directoryMsg(QApplication::activeWindow());
    98             directoryMsg.setIcon(QMessageBox::Warning);
    98             directoryMsg.setIcon(QMessageBox::Warning);
    99             directoryMsg.setWindowTitle(QMessageBox::tr("Main - Error"));
    99             directoryMsg.setWindowTitle(QMessageBox::tr("Main - Error"));
   100             directoryMsg.setText(QMessageBox::tr("Cannot create directory %1").arg(dir));
   100             directoryMsg.setText(QMessageBox::tr("Cannot create directory %1").arg(dir));
   101             directoryMsg.setWindowModality(Qt::WindowModal);
   101             directoryMsg.setWindowModality(Qt::WindowModal);
   102             directoryMsg.exec();
   102             directoryMsg.exec();
   103             return false;
   103             return false;
   104         }
   104         }
   105     return true;
   105     return true;
       
   106 }
       
   107 
       
   108 bool checkForFile(const QString & file)
       
   109 {
       
   110     QFile tmpfile(file);
       
   111     if (!tmpfile.exists())
       
   112         return tmpfile.open(QFile::WriteOnly);
       
   113     else
       
   114         return true;
   106 }
   115 }
   107 
   116 
   108 #ifdef __APPLE__
   117 #ifdef __APPLE__
   109 static CocoaInitializer *cocoaInit = NULL;
   118 static CocoaInitializer *cocoaInit = NULL;
   110 // Function to be called at end of program's termination on OS X to release
   119 // Function to be called at end of program's termination on OS X to release
   249     engine.mount(datadir->absolutePath());
   258     engine.mount(datadir->absolutePath());
   250     engine.mount(cfgdir->absolutePath() + "/Data");
   259     engine.mount(cfgdir->absolutePath() + "/Data");
   251     engine.mount(cfgdir->absolutePath());
   260     engine.mount(cfgdir->absolutePath());
   252     engine.setWriteDir(cfgdir->absolutePath());
   261     engine.setWriteDir(cfgdir->absolutePath());
   253     engine.mountPacks();
   262     engine.mountPacks();
       
   263 
       
   264     checkForFile("physfs://hedgewars.ini");
   254 
   265 
   255     QTranslator Translator;
   266     QTranslator Translator;
   256     {
   267     {
   257         QSettings settings("physfs://hedgewars.ini", QSettings::IniFormat);
   268         QSettings settings("physfs://hedgewars.ini", QSettings::IniFormat);
   258         QString cc = settings.value("misc/locale", QString()).toString();
   269         QString cc = settings.value("misc/locale", QString()).toString();