fix: setAutostart接口优化
非法desktop文件或者非本地应用,直接返回false Log: Influence: setAutostart接口功能正常 Task: https://pms.uniontech.com/task-view-215413.html Change-Id: Idec45c8c314e1a0bd3db93e8a1d85c3cab634905
This commit is contained in:
parent
885ad9b07a
commit
c726a91c0f
@ -251,6 +251,11 @@ void StartManager::onAutoStartupPathChange(const QString &path)
|
||||
|
||||
bool StartManager::setAutostart(const QString &desktop, const bool value)
|
||||
{
|
||||
if (!desktop.endsWith(".desktop")) {
|
||||
qWarning() << "invalid desktop item...";
|
||||
return false;
|
||||
}
|
||||
|
||||
QString desktopFullPath = desktop;
|
||||
QFileInfo info(desktopFullPath);
|
||||
if (!info.isAbsolute()) {
|
||||
@ -270,6 +275,12 @@ bool StartManager::setAutostart(const QString &desktop, const bool value)
|
||||
}
|
||||
}
|
||||
|
||||
// 本地没有找到该应用就直接返回
|
||||
if (!info.isAbsolute()) {
|
||||
qWarning() << "invalid item...";
|
||||
return false;
|
||||
}
|
||||
|
||||
QDir autostartDir(BaseDir::userAutoStartDir().c_str());
|
||||
const QString &appId = info.baseName();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user