added opt path

This commit is contained in:
Maxim Stewart 2020-07-05 17:42:28 -05:00
parent 868b075bd5
commit af81743c2e
1 changed files with 57 additions and 43 deletions

View File

@ -27,8 +27,8 @@ class Main(Context):
while True: while True:
self.clear() self.clear()
if not self.menuData: if not self.menuData:
HOME = os.path.expanduser('~') + "/.local/share/applications/" HOME_APPS = os.path.expanduser('~') + "/.local/share/applications/"
paths = ["/usr/share/applications/", HOME] paths = ["/opt/", "/usr/share/applications/", HOME_APPS]
self.menuData = self.getDesktopFilesInfo(paths) self.menuData = self.getDesktopFilesInfo(paths)
group = self.call_method("mainMenu")["group"] group = self.call_method("mainMenu")["group"]
@ -68,6 +68,19 @@ class Main(Context):
} }
for path in paths: for path in paths:
if not "/opt/" in path:
self.listAndUpdateDesktopFiles(path, menuObjs);
else:
for folder in listdir(path):
try:
fPath = path + folder
self.listAndUpdateDesktopFiles(fPath, menuObjs);
except Exception as e:
self.logger.debug(e)
return menuObjs
def listAndUpdateDesktopFiles(self, path, menuObjs):
for f in listdir(path): for f in listdir(path):
fPath = path + f fPath = path + f
flags = ["mimeinfo.cache", "defaults.list"] flags = ["mimeinfo.cache", "defaults.list"]
@ -110,11 +123,11 @@ class Main(Context):
"tryExec": tryExec, "fileName": f "tryExec": tryExec, "fileName": f
}) })
return menuObjs
def getSubgroup(self, group, query = ""): def getSubgroup(self, group, query = ""):
""" """
# TODO:
Need to refactor and pull out the sub logic that is used in both cases... Need to refactor and pull out the sub logic that is used in both cases...
""" """
desktopObjs = [] desktopObjs = []
@ -145,6 +158,7 @@ class Main(Context):
def executeProgram(self, group, entry): def executeProgram(self, group, entry):
""" """
# TODO:
Need to refactor and pull out the sub loop that is used in both cases... Need to refactor and pull out the sub loop that is used in both cases...
""" """
parts = entry.split("||") parts = entry.split("||")