Bug 1442419 - Fix failure to open files after downloading with snap r=jlorenzo

This fix does several things:
 * Removes the mime cache generated by the desktop-gtk3 remote part
 * Installs a stub shared-mime-info database
 * Set default association for all types to use xdg-open

Note: There is still work[1] to be completed in snapd, adding OpenFile
support to xdg-open.  Landing this is harmless though, it will fail
silently just as it does today but will start working when the snapd
feature lands.

1. https://github.com/snapcore/snapd/pull/4766
opening requested files,

MozReview-Commit-ID: 1eeOLeVN8xQ

--HG--
extra : rebase_source : e948bafc583f91177530ce00ec26c69619a7f8f9
This commit is contained in:
Ken VanDine 2018-03-01 22:02:21 +00:00
parent 111625afbc
commit ca87e2403a
3 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,7 @@
<mime-info
xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/octet-stream">
<comment>Unknown</comment>
<glob pattern="*"/>
</mime-type>
</mime-info>

View File

@ -0,0 +1,4 @@
[Default Applications]
application/octet-stream=xdg-open.desktop
text/plain=xdg-open.desktop
inode/directory=xdg-open.desktop

View File

@ -36,6 +36,10 @@ plugs:
allow-sandbox: true
parts:
desktop-gtk3:
prime:
- -usr/share/mime
firefox:
plugin: dump
source: source
@ -52,11 +56,30 @@ parts:
- ffmpeg
after: [desktop-gtk3]
optimization:
xdg-open:
after: [firefox]
plugin: nil
stage-packages:
- shared-mime-info
source: .
install: |
set -eux
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications
install -m 644 mimeapps.list $SNAPCRAFT_PART_INSTALL/usr/share/applications
update-desktop-database -v $SNAPCRAFT_PART_INSTALL/usr/share/applications
build-packages:
- desktop-file-utils
build-attributes: [no-system-libraries]
shared-mime-info:
after: [xdg-open]
plugin: nil
source: .
build-packages:
- shared-mime-info
build-attributes: [no-system-libraries]
install: |
set -eux
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/mime/packages
install -m 644 mime-handler.xml $SNAPCRAFT_PART_INSTALL/usr/share/mime/packages
update-mime-database $SNAPCRAFT_PART_INSTALL/usr/share/mime
stage:
- usr/share/mime