-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (31 loc) · 978 Bytes
/
Copy pathmain.cpp
File metadata and controls
37 lines (31 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "mainwindow.h"
#include <QApplication>
#include <QDir>
#include <QProcess>
#include <QtDebug>
#include <QJSEngine>
#include "setting.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDir::home().mkpath("shelllet.com");
QProcess process;
auto filename = Setting::LetPath();
auto dir = QFileInfo(filename).absoluteDir().absolutePath();
process.setWorkingDirectory(dir);
QStringList params;
params << "run";
params << qApp->applicationDirPath() + QDir::separator() + "assets" + QDir::separator() + "scripts" + QDir::separator() + "check_process.js";
process.start(filename, params);
if (process.waitForFinished()) {
QByteArray result = process.readAllStandardError();
QJSEngine myEngine;
QJSValue three = myEngine.evaluate(QString(result));
if (three.isBool() && three.toBool()){
return 0;
}
}
MainWindow w;
w.show();
return a.exec();
}