Skip to content

Commit

Permalink
chore: remove decltype(auto) for dutil
Browse files Browse the repository at this point in the history
Log: remove decltype(auto)
  • Loading branch information
chenchongbiao committed Dec 12, 2023
1 parent af8b766 commit a0a4721
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/util/dutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ inline QString unescapeFromObjectPath(const QString &str)

inline QString getAppIdFromAbsolutePath(const QString &path)
{
decltype(auto) desktopSuffix = u8".desktop";
static QString desktopSuffix{u8".desktop"};
const auto &appDirs = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
if (!path.endsWith(desktopSuffix) or
!std::any_of(appDirs.cbegin(), appDirs.constEnd(), [&path](const QString &dir) { return path.startsWith(dir); })) {
return {};
}

auto tmp = path.chopped(sizeof(desktopSuffix) - 1);
auto tmp = path.chopped(desktopSuffix.size() - 1);
auto components = tmp.split(QDir::separator(), Qt::SkipEmptyParts);
auto location = std::find(components.cbegin(), components.cend(), "applications");
if (location == components.cend()) {
Expand Down

0 comments on commit a0a4721

Please sign in to comment.