mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-23 03:22:20 +08:00
feat: 检查 /tmp/spark-store 目录权限
This commit is contained in:
parent
496d20d536
commit
6bd05655d6
@ -14,6 +14,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define AppPageApplist 0
|
#define AppPageApplist 0
|
||||||
#define AppPageSearchlist 1
|
#define AppPageSearchlist 1
|
||||||
@ -32,11 +33,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
initTmpDir();
|
|
||||||
|
|
||||||
initUI();
|
initUI();
|
||||||
initConnections();
|
initConnections();
|
||||||
|
|
||||||
|
initTmpDir();
|
||||||
|
|
||||||
ui->appintopage->setDownloadWidget(downloadlistwidget);
|
ui->appintopage->setDownloadWidget(downloadlistwidget);
|
||||||
|
|
||||||
emit DGuiApplicationHelper::instance()->themeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
emit DGuiApplicationHelper::instance()->themeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
||||||
@ -393,6 +394,28 @@ void MainWindow::initTmpDir()
|
|||||||
// 新建临时文件夹
|
// 新建临时文件夹
|
||||||
QDir dir;
|
QDir dir;
|
||||||
dir.mkpath("/tmp/spark-store");
|
dir.mkpath("/tmp/spark-store");
|
||||||
|
|
||||||
|
// 检查写入权限
|
||||||
|
QFileInfo info("/tmp/spark-store");
|
||||||
|
qDebug() << info.isWritable();
|
||||||
|
if (info.isWritable() == false)
|
||||||
|
{
|
||||||
|
QtConcurrent::run([=]
|
||||||
|
{
|
||||||
|
sleep(3);
|
||||||
|
auto upgradeP = new QProcess();
|
||||||
|
upgradeP->startDetached("zenity", QStringList() << "--warning"
|
||||||
|
<< "--text"
|
||||||
|
<< "用户未拥有 /tmp/spark-store 写入权限,星火商店会因此工作异常,请检查!"
|
||||||
|
<< "--title"
|
||||||
|
<< "权限受限提示"
|
||||||
|
<< "--width"
|
||||||
|
<< "360"
|
||||||
|
);
|
||||||
|
upgradeP->waitForStarted();
|
||||||
|
upgradeP->waitForFinished(30);
|
||||||
|
upgradeP->deleteLater(); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::switchPage(int now) // 临时方案,回家后修改
|
void MainWindow::switchPage(int now) // 临时方案,回家后修改
|
||||||
|
Loading…
x
Reference in New Issue
Block a user