GNOME Bugzilla – Bug 792068
Make it work with Flatpak
Last modified: 2018-01-12 20:26:19 UTC
When the Devhelp application is launched with Flatpak, by default no books are found, it is empty, which is a bit sad. It should instead find the books installed on the host (e.g. installed with traditional Linux distro packages). See the populate() function in DhBookManager, it searches books in g_get_user_data_dir() and g_get_system_data_dirs(), at least that's what it does in 2017. Inside Flatpak those functions probably return something different.
Here is the list of data dirs inside Flatpak: /home/seb/.var/app/org.gnome.Devhelp/data /app/share /usr/share /usr/share/runtime/share /run/host/share After installing org.gnome.Sdk.Docs, inside the Flatpak sandbox we see its documentation in /usr/share/gtk-doc/html/. But the content of that directory is different than on the host. Inside the Flatpak sandbox, /usr/share/gtk-doc/html is actually a symbolic link to /usr/share/runtime/docs/gtk-doc/html. So currently with Devhelp-Flatpak, we can see the docs of org.gnome.Sdk.Docs if installed. But not the documentation installed on the host (system-wide).
If --filesystem=host is added to the flatpak build-finish args, then the documentation which is available on the host in /usr/share/gtk-doc/html/, is available inside the Flatpak sandbox in /run/host/usr/share/gtk-doc/html/. But g_get_system_data_dirs() inside Flatpak doesn't return /run/host/usr/share.
I've filed: https://github.com/flatpak/flatpak/issues/1299 Comment from TingPing: > Personally I don't think this is behavior that should be used in practice, host > state is exactly what Flatpak's shouldn't be using, host is just a workaround to > keep applications working and not desired behavior IMO. To solve that problem longer-term, there is for example bug #761284. When Devhelp will download API docs, it can save them in a location accessible from Flatpak.
OK so it's normal that XDG_DATA_DIRS doesn't contain /run/host/usr/share, see the flatpak issue. It's quite easy in DhBookManager to find books in one more datadir, with the path hard-coded. This could be enabled with a compile-time configuration option (--enable-flatpak for example).
Done: commit 011f46edfce6d16860cfa2724a3174e28e622def