QTfrontend/hwform.cpp
changeset 4091 f89b8d0afbe1
parent 4090 4b165832d232
child 4232 3a7862405c36
equal deleted inserted replaced
4090:4b165832d232 4091:f89b8d0afbe1
  1133     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\"");
  1133     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\"");
  1134 #elif defined __APPLE__
  1134 #elif defined __APPLE__
  1135     success = false;
  1135     success = false;
  1136     // TODO; also reenable button in pages.cpp
  1136     // TODO; also reenable button in pages.cpp
  1137 #else
  1137 #else
       
  1138     // this is a little silly due to all the system commands below anyway - just use mkdir -p ?  Does have the advantage of the alert I guess
  1138     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1139     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1139     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1140     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1140     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime");
  1141     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime");
  1141     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime/packages");
  1142     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime/packages");
  1142     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1143     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1143     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1144     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1144     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications");
  1145     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications");
  1145     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
  1146     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
  1146     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1147     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1147     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
  1148     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
       
  1149     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0;
       
  1150     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0;
  1148 #endif
  1151 #endif
  1149     if (success) QMessageBox::information(0, "", QMessageBox::tr("All file associations have been set."));
  1152     if (success) QMessageBox::information(0, "", QMessageBox::tr("All file associations have been set."));
  1150     else QMessageBox::information(0, "", QMessageBox::tr("File association failed."));
  1153     else QMessageBox::information(0, "", QMessageBox::tr("File association failed."));
  1151 }
  1154 }
  1152 
  1155