From 5680b08e1c41b4b6dd257c9deb3a46782208767e Mon Sep 17 00:00:00 2001 From: kramo Date: Sun, 27 Aug 2023 16:19:35 +0200 Subject: [PATCH] Desktop entry source improvements --- src/importer/sources/desktop_source.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/importer/sources/desktop_source.py b/src/importer/sources/desktop_source.py index 1d11507..3a50dee 100644 --- a/src/importer/sources/desktop_source.py +++ b/src/importer/sources/desktop_source.py @@ -20,7 +20,6 @@ import os import shlex import subprocess -from hashlib import sha3_256 from pathlib import Path from time import time from typing import NamedTuple @@ -118,15 +117,18 @@ class DesktopSourceIterable(SourceIterable): except GLib.GError: pass + # Strip /run/host from Flatpak paths + if entry.is_relative_to(prefix := "/run/host"): + entry = Path("/") / entry.relative_to(prefix) + + launch_arg = shlex.quote(str(entry if full_path else entry.stem)) + values = { "source": self.source.source_id, "added": added_time, "name": name, - "game_id": "desktop_" - + sha3_256( - str(entry).encode("utf-8"), usedforsecurity=False - ).hexdigest(), - "executable": f"{launch_command} {shlex.quote(str(entry if full_path else entry.stem))}", + "game_id": f"desktop_{entry.stem}", + "executable": f"{launch_command} {launch_arg}", } game = Game(values)