Skip to content

Commit faf1be9

Browse files
committed
fix: dock application icons will lose when upgrading components
If have a custom desktop export directory, you need to ensure compatibility and export the desktop files to both the old and new directories.
1 parent 9f7b240 commit faf1be9

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

libs/linglong/src/linglong/repo/ostree_repo.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,16 +2102,6 @@ OSTreeRepo::exportEntries(const std::filesystem::path &rootEntriesDir,
21022102
destination = rootEntriesDir / "lib/systemd/user";
21032103
}
21042104

2105-
auto desktopExportPath = std::string{ LINGLONG_EXPORT_PATH } + "/applications";
2106-
2107-
if (path == "share/applications") {
2108-
if (desktopExportPath != "share/applications") {
2109-
qInfo() << "destination update from " << destination.c_str() << " to "
2110-
<< QString::fromStdString(rootEntriesDir / desktopExportPath);
2111-
}
2112-
destination = rootEntriesDir / desktopExportPath;
2113-
}
2114-
21152105
if (path == "share/deepin-elf-verify") {
21162106
destination = rootEntriesDir / "share/deepin-elf-verify" / item.commit;
21172107
}
@@ -2128,6 +2118,23 @@ OSTreeRepo::exportEntries(const std::filesystem::path &rootEntriesDir,
21282118
if (!ret.has_value()) {
21292119
return ret;
21302120
}
2121+
2122+
if (path == "share/applications") {
2123+
auto desktopExportPath = std::string{ LINGLONG_EXPORT_PATH } + "/applications";
2124+
2125+
// 如果存在自定义的desktop安装路径,则也需要将desktop文件导出到指定目录
2126+
if (desktopExportPath != "share/applications") {
2127+
qInfo() << "destination update from " << destination.c_str() << " to "
2128+
<< QString::fromStdString(rootEntriesDir / desktopExportPath);
2129+
2130+
destination = rootEntriesDir / desktopExportPath;
2131+
2132+
auto ret = this->exportDir(item.info.id, source, destination, 10);
2133+
if (!ret.has_value()) {
2134+
return ret;
2135+
}
2136+
}
2137+
}
21312138
}
21322139
return LINGLONG_OK;
21332140
}

0 commit comments

Comments
 (0)