fix: unable get docked entriy by soft link path

set canonicalFilePath instead of absoluteFilePath for deskfileinfo
and find it by canonicalFilePath instead of user input path

log: use canonicalFilePath instead of absoluteFilePath
This commit is contained in:
tsic404 2024-01-23 17:14:23 +08:00 committed by deepin-bot[bot]
parent 0300e28332
commit 3939ca9c12
2 changed files with 4 additions and 2 deletions

View File

@ -40,7 +40,7 @@ DesktopInfo::DesktopInfo(const QString &desktopfile)
} }
} }
m_desktopFilePath = desktopFileInfo.absoluteFilePath(); m_desktopFilePath = desktopFileInfo.canonicalFilePath();
m_isValid = desktopFileInfo.isAbsolute() && QFile::exists(desktopFileInfo.absoluteFilePath()); m_isValid = desktopFileInfo.isAbsolute() && QFile::exists(desktopFileInfo.absoluteFilePath());
m_desktopFile.reset(new QSettings(m_desktopFilePath, QSettings::IniFormat)); m_desktopFile.reset(new QSettings(m_desktopFilePath, QSettings::IniFormat));
m_desktopFile->setIniCodec("utf-8"); m_desktopFile->setIniCodec("utf-8");

View File

@ -162,9 +162,11 @@ QList<Entry*> Entries::getEntries()
Entry *Entries::getDockedEntryByDesktopFile(const QString &desktopFile) Entry *Entries::getDockedEntryByDesktopFile(const QString &desktopFile)
{ {
QFileInfo desktopFileInfo(desktopFile);
Entry *ret = nullptr; Entry *ret = nullptr;
for (auto entry : filterDockedEntries()) { for (auto entry : filterDockedEntries()) {
if ((entry->isValid()) && desktopFile == entry->getFileName()) { if ((entry->isValid()) && desktopFileInfo.canonicalFilePath() == entry->getFileName()) {
ret = entry; ret = entry;
break; break;
} }