equal
deleted
inserted
replaced
42 |
42 |
43 QDir * bindir; |
43 QDir * bindir; |
44 QDir * cfgdir; |
44 QDir * cfgdir; |
45 QDir * datadir; |
45 QDir * datadir; |
46 |
46 |
|
47 bool checkForDir(const QString & dir) |
|
48 { |
|
49 QDir tmpdir; |
|
50 if (!tmpdir.exists(dir)) |
|
51 if (!tmpdir.mkdir(dir)) |
|
52 { |
|
53 QMessageBox::critical(0, |
|
54 QObject::tr("Error"), |
|
55 QObject::tr("Cannot create directory %1").arg(dir), |
|
56 QObject::tr("OK")); |
|
57 return false; |
|
58 } |
|
59 return true; |
|
60 } |
|
61 |
47 int main(int argc, char *argv[]) |
62 int main(int argc, char *argv[]) |
48 { |
63 { |
49 QApplication app(argc, argv); |
64 QApplication app(argc, argv); |
50 |
65 |
51 QDateTime now = QDateTime::currentDateTime(); |
66 QDateTime now = QDateTime::currentDateTime(); |
63 |
78 |
64 bindir = new QDir(mydir); |
79 bindir = new QDir(mydir); |
65 cfgdir = new QDir(); |
80 cfgdir = new QDir(); |
66 |
81 |
67 cfgdir->setPath(cfgdir->homePath()); |
82 cfgdir->setPath(cfgdir->homePath()); |
68 if (!cfgdir->exists(".hedgewars")) |
83 if (checkForDir(cfgdir->absolutePath() + "/.hedgewars")) |
69 { |
84 { |
70 if (!cfgdir->mkdir(".hedgewars")) |
85 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos"); |
71 { |
|
72 QMessageBox::critical(0, |
|
73 QObject::tr("Error"), |
|
74 QObject::tr("Cannot create directory %1").arg("/.hedgewars"), |
|
75 QObject::tr("Quit")); |
|
76 } |
|
77 } |
86 } |
78 cfgdir->cd(".hedgewars"); |
87 cfgdir->cd(".hedgewars"); |
79 |
88 |
80 datadir = new QDir(mydir); |
89 datadir = new QDir(mydir); |
81 datadir->cd("../share/hedgewars/Data"); |
90 datadir->cd("../share/hedgewars/Data"); |