From 5eb578d53e961f05f430d7d51d285a1c8bf42792 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 18 Jun 2008 11:28:31 +0100 Subject: [PATCH] Find help for ROX applications automatically If doc-dir isn't set try /Help. Also, refuse to open documentation directories that appear to be appdirs, since xdg-open would run them instead. --- zeroinstall/gtkui/applistbox.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zeroinstall/gtkui/applistbox.py b/zeroinstall/gtkui/applistbox.py index 74c992c..29c0a96 100644 --- a/zeroinstall/gtkui/applistbox.py +++ b/zeroinstall/gtkui/applistbox.py @@ -154,6 +154,19 @@ class AppListBox: assert path, "Chosen implementation is not cached!" if help_dir: path = os.path.join(path, help_dir) + else: + main = impl.main + if main: + # Hack for ROX applications. They should be updated to + # set doc-dir. + help_dir = os.path.join(path, os.path.dirname(main), 'Help') + if os.path.isdir(help_dir): + path = help_dir + + # xdg-open has no "safe" mode, so check we're not "opening" an application. + if os.path.exists(os.path.join(path, 'AppRun')): + raise Exception("Documentation directory '%s' is an AppDir; refusing to open" % path) + subprocess.Popen(['xdg-open', path]) def action_properties(self, uri): -- 2.11.4.GIT