Desktop entry source improvements
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
import os
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
from hashlib import sha3_256
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from time import time
|
from time import time
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
@@ -118,15 +117,18 @@ class DesktopSourceIterable(SourceIterable):
|
|||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
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 = {
|
values = {
|
||||||
"source": self.source.source_id,
|
"source": self.source.source_id,
|
||||||
"added": added_time,
|
"added": added_time,
|
||||||
"name": name,
|
"name": name,
|
||||||
"game_id": "desktop_"
|
"game_id": f"desktop_{entry.stem}",
|
||||||
+ sha3_256(
|
"executable": f"{launch_command} {launch_arg}",
|
||||||
str(entry).encode("utf-8"), usedforsecurity=False
|
|
||||||
).hexdigest(),
|
|
||||||
"executable": f"{launch_command} {shlex.quote(str(entry if full_path else entry.stem))}",
|
|
||||||
}
|
}
|
||||||
game = Game(values)
|
game = Game(values)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user