Fixed resolve_path logic
This commit is contained in:
@@ -70,7 +70,7 @@ class DBusManager:
|
|||||||
"org.mpris.MediaPlayer2.TrackList.xml",
|
"org.mpris.MediaPlayer2.TrackList.xml",
|
||||||
]
|
]
|
||||||
for spec in specs:
|
for spec in specs:
|
||||||
spec_path = resolve_path(f"dbus/mpris_specs/{spec}")
|
spec_path = resolve_path("dbus/mpris_specs", spec)
|
||||||
with open(spec_path) as f:
|
with open(spec_path) as f:
|
||||||
node_info = Gio.DBusNodeInfo.new_for_xml(f.read())
|
node_info = Gio.DBusNodeInfo.new_for_xml(f.read())
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ from typing import Union
|
|||||||
def resolve_path(*joinpath_args: Union[str, Path]) -> Path:
|
def resolve_path(*joinpath_args: Union[str, Path]) -> Path:
|
||||||
roots = (Path(__file__).parent, Path("/usr/share/sublime-music"))
|
roots = (Path(__file__).parent, Path("/usr/share/sublime-music"))
|
||||||
for root in roots:
|
for root in roots:
|
||||||
if fullpath := root.joinpath(*joinpath_args).resolve():
|
if (fullpath := root.joinpath(*joinpath_args).resolve()).exists():
|
||||||
return fullpath
|
return fullpath
|
||||||
|
|
||||||
raise FileNotFoundError(
|
raise FileNotFoundError(
|
||||||
|
Reference in New Issue
Block a user