Before this change, info's handling of 'direct' snaps (i.e. `snap info
foo.snap` and `snap info ./foo`) used a separate codepath from the
handling of locally-installed snaps and remote snaps. This led to the
output for direct snaps to diverge more than necessary from the output
of snaps that snapd knew about, as well as to some code duplication.
This change fixes that: before,
```
~$ snap info basic-desktop_1.0_all.snap
path: "basic-desktop_1.0_all.snap"
name: basic-desktop
summary: ""
version: 1.0 -
```
and now,
```
~$ snap info basic-desktop_1.0_all.snap
path: "basic-desktop_1.0_all.snap"
name: basic-desktop
summary: ""
version: 1.0 -
build-date: today at 11:24 GMT
license: GPL-3.0
description: |
A basic snap with desktop apps
commands:
- basic-desktop.echo
- basic-desktop.echoecho
```
Furthermore, in verbose mode, this change adds errors for each of the
methods that were tried and failed, when they all failed:
```
$ snap info potato --verbose
error: treating "potato" as a path to a snap: cannot open snap: open potato: no such file or directory
error: treating "potato" as a locally-installed snap name: cannot retrieve snap "potato": snap not installed
error: treating "potato" as a snap name in the store: cannot find snap "potato": snap not found
error: no snap found for "potato"
```
When we added support for parallel installs we broke removal of
some desktop files. This was reported in LP: 1791182. The problematic
commit is 84008e.
This PR changes the way we write and remove desktop files. One
problem here is that desktop files of a foo_instance will get
removed when "snap remove foo" happens. Given that parallel installs
are experimental this might be acceptable (or not).