From c58fc0781c44723d61cf04ee1cc750db48ad39c0 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Wed, 6 Jul 2016 15:57:00 -0400 Subject: [PATCH] Call xdg-open properly in jsonrpc_reveal() --- lbrynet/lbrynet_daemon/LBRYDaemon.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index 16dc95c86..62af52e40 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -2243,19 +2243,21 @@ class LBRYDaemon(jsonrpc.JSONRPC): def jsonrpc_reveal(self, p): """ - Open a folder in finder/file explorer + Reveal a file or directory in file browser Args: - 'path': path to be selected in finder + 'path': path to be selected in file browser Returns: - True, opens finder + True, opens file browser """ path = p['path'] if sys.platform == "darwin": d = threads.deferToThread(subprocess.Popen, ['open', '-R', path]) else: - d = threads.deferToThread(subprocess.Popen, ['xdg-open', '-R', path]) + # No easy way to reveal specific files on Linux, so just open the containing directory + d = threads.deferToThread(subprocess.Popen, ['xdg-open', os.dirname(path)]) + d.addCallback(lambda _: self._render_response(True, OK_CODE)) return d