fix: 修复设置开机自启动应用重启后失效问题

1. 设置自动启动时未将应用desktop文件写入到~/.config/autostart/目录下
2. 应用自动启动接口优化,确保调用时,接口返回正确。
(设置为自启动时,手动将Hidden字段写入到自启动目录的desktop文件中,并设置为false,只有这样,
安全中心才不会弹出自启动确认窗口, 这种操作是沿用V20阶段的约定规范,这块已经与安全中心研发对接过)

Log:
Influence: 设置自启动后重启应用也会保持生效
Bug: https://pms.uniontech.com/bug-view-172263.html
Bug: https://pms.uniontech.com/bug-view-172281.html
Task: https://pms.uniontech.com/task-view-215413.html
Change-Id: Idd03ac40850c95ef8cef2ac169cfe006405b809b
This commit is contained in:
songwentao
2022-11-23 14:36:04 +08:00
parent f6e6739532
commit 8be1b299e6
5 changed files with 85 additions and 114 deletions

View File

@ -188,9 +188,10 @@ void KeyFile::setKey(const std::string &section, const std::string &key, const s
bool KeyFile::saveToFile(const std::string &filePath)
{
FILE *sfp = fopen(filePath.data(), "w+");
if (!sfp)
if (!sfp) {
perror("open file failed...");
return false;
}
for (const auto &im : m_mainKeyMap) {
const auto &keyMap = im.second;