mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-12-14 11:02:04 +08:00
初步的兼容层检测
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QProcess>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
MainWindow::MainWindow(){
|
MainWindow::MainWindow(){
|
||||||
@@ -220,8 +222,21 @@ QByteArray MainWindow::readtxtByte(QString path){
|
|||||||
return things;
|
return things;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::write_txt(QString path, QString things){
|
void MainWindow::write_txt(QString path, QByteArray things){
|
||||||
|
QFile file(path);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
file.write(things);
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MainWindow::GetCommandResult(QString command){
|
||||||
|
QProcess process;
|
||||||
|
process.start(command);
|
||||||
|
process.waitForStarted();
|
||||||
|
process.waitForFinished();
|
||||||
|
QString result = process.readAll();
|
||||||
|
process.close();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -343,7 +358,35 @@ void MainWindow::CheckWine(){
|
|||||||
nameValue.append(QStringList() << "基于 box86 的 " << "box86 ");
|
nameValue.append(QStringList() << "基于 box86 的 " << "box86 ");
|
||||||
}
|
}
|
||||||
if(!system("which box64")){
|
if(!system("which box64")){
|
||||||
nameValue.append(QStringList() << "基于 box86 的 " << "box86 ");
|
nameValue.append(QStringList() << "基于 box64 的 " << "box64 ");
|
||||||
|
}
|
||||||
|
if(!system("which qemu-i386") &&
|
||||||
|
GetCommandResult("arch").replace(" ", "").replace("\n", "") != "x86_64" &&
|
||||||
|
GetCommandResult("arch").replace(" ", "").replace("\n", "") != "i686"){
|
||||||
|
nameValue.append(QStringList() << "基于 qemu-i386 的 " << "qemu-i386 ");
|
||||||
|
}
|
||||||
|
if(!system("which qemu-x86_64") &&
|
||||||
|
GetCommandResult("arch").replace(" ", "").replace("\n", "") != "x86_64" &&
|
||||||
|
GetCommandResult("arch").replace(" ", "").replace("\n", "") != "i686"){
|
||||||
|
nameValue.append(QStringList() << "基于 qemu-x86_64 的 " << "qemu-x86_64 ");
|
||||||
|
}
|
||||||
|
if(QFile::exists("/opt/exagear/bin/ubt_x64a64_al") && QFile::exists(homePath + "/.deepinwine/debian-buster")){
|
||||||
|
nameValue.append(QStringList() << "基于 UOS exagear 的 " << "WINEPREDLL='" + programPath + "/dlls-arm' "\
|
||||||
|
"WINEDLLPATH=/opt/deepin-wine6-stable/lib /opt/exagear/bin/ubt_x64a64_al --path-prefix " + get_home() + "/.deepinwine/debian-buster "\
|
||||||
|
"--utmp-paths-list " + homePath + "/.deepinwine/debian-buster/.exagear/utmp-list --vpaths-list " + homePath + "/.deepinwine/debian-buster/.exagear/vpaths-list "\
|
||||||
|
"--opaths-list " + homePath + "/.deepinwine/debian-buster/.exagear/opaths-list --smo-mode fbase --smo-severity smart --fd-limit 8192 --foreign-ubt-binary /opt/exagear/bin/ubt_x32a64_al -- ");
|
||||||
|
}
|
||||||
|
if(!system("which exagear")){
|
||||||
|
nameValue.append(QStringList() << "运行 exagear 容器内的 " << "exagear -- ");
|
||||||
|
}
|
||||||
|
if(QFile::exists("/opt/exagear/bin/ubt_x64a64_al")){
|
||||||
|
nameValue.append(QStringList() << "使用 ubt_x64a64_al 运行" << "/opt/exagear/bin/ubt_x64a64_al -- ");
|
||||||
|
}
|
||||||
|
if(QFile::exists("/opt/exagear/bin/ubt_x32a64_al")){
|
||||||
|
nameValue.append(QStringList() << "使用 ubt_x32a64_al 运行" << "/opt/exagear/bin/ubt_x32a64_al -- ");
|
||||||
|
}
|
||||||
|
for(QString g: qemuBottleList){
|
||||||
|
nameValue.append(QStringList() << "使用qemu-" + g[0] + "-static 调用容器" + g[1] + "运行 " << "python3 '" + programPath + "/QemuRun.py' '" + g[0] + "/" + g[1] + "' " + setting.value("QemuUnMountHome").toInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(QString msg){
|
catch(QString msg){
|
||||||
|
|||||||
@@ -14,8 +14,9 @@ public:
|
|||||||
void CheckWine();
|
void CheckWine();
|
||||||
QString get_home();
|
QString get_home();
|
||||||
QString readtxt(QString path);
|
QString readtxt(QString path);
|
||||||
void write_txt(QString path, QString things);
|
void write_txt(QString path, QByteArray things);
|
||||||
QByteArray readtxtByte(QString path);
|
QByteArray readtxtByte(QString path);
|
||||||
|
QString GetCommandResult(QString command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString homePath = QDir::homePath();
|
QString homePath = QDir::homePath();
|
||||||
|
|||||||
Reference in New Issue
Block a user