Browse Source

more safeguards against not converted programs in the database

tags/v0.2.1
Nils 5 months ago
parent
commit
6ca627d705
2 changed files with 8 additions and 4 deletions
  1. +3
    -0
      CHANGELOG
  2. +5
    -4
      engine/findprograms.py

+ 3
- 0
CHANGELOG View File

@@ -1,3 +1,6 @@
2020-15-01 0.2.1
Remove Nuitka as dependency. Build commands stay the same.

2020-12-05 0.2.0
Fix crash from Qt/PyQt regression with Qt 5.15.2
Install nsm-data manpage

+ 5
- 4
engine/findprograms.py View File

@@ -203,7 +203,7 @@ class SupportedProgramsDatabase(object):
def _exeToDesktopEntry(self, exe:str)->dict:
"""Assumes self.desktopEntries is up to date
Convert one exe (not full path!) to one dict entry. """
if exe in self.knownDesktopFiles: #Shortcut through internal database
if exe in self.knownDesktopFiles and type(self.knownDesktopFiles[exe]) is dict : #Shortcut through internal database
entry = self.knownDesktopFiles[exe]
return entry
else: #Reverse Search desktop files.
@@ -211,7 +211,6 @@ class SupportedProgramsDatabase(object):
if "exec" in entry and exe.lower() in entry["exec"].lower():
return entry
#else: #Foor loop ended. Did not find any matching desktop file

return None

def _build(self):
@@ -224,8 +223,7 @@ class SupportedProgramsDatabase(object):
for exe, fullPath in self.executables:
self.progressHook(f"{fullPath}")
entry = self._exeToDesktopEntry(exe)
if entry: #Found match!
assert type(entry) is dict, type(entry)
if entry and type(entry) is dict: #Found match!
entry["agordejoFullPath"] = fullPath
#We don't want .desktop syntax like "qmidiarp %F"
entry["agordejoExec"] = exe
@@ -245,6 +243,9 @@ class SupportedProgramsDatabase(object):
leftovers.remove((exe,fullPath))
except KeyError:
pass #Double entries like zyn-jack zyn-alsa etc.
elif entry and not type(entry) is dict:
#There is a strange bug I can't reproduce. At least catch it.
logger.error(f"Wrong entry type: {type(entry)} for {entry}")

for exe,fullPath in leftovers:
pseudoEntry = {"name": exe.title(), "agordejoExec":exe, "agordejoFullPath":fullPath}

Loading…
Cancel
Save