func generateWrappers(s *snap.Info) error { // add the CLI apps from the snap.yaml if err := wrappers.AddSnapBinaries(s); err != nil { return err } // add the daemons from the snap.yaml if err := wrappers.AddSnapServices(s, &progress.NullProgress{}); err != nil { return err } // add the desktop files if err := wrappers.AddSnapDesktopFiles(s); err != nil { return err } return nil }
func (s *desktopSuite) TestAddPackageDesktopFiles(c *C) { expectedDesktopFilePath := filepath.Join(dirs.SnapDesktopFilesDir, "foo_foobar.desktop") c.Assert(osutil.FileExists(expectedDesktopFilePath), Equals, false) info := snaptest.MockSnap(c, desktopAppYaml, &snap.SideInfo{Revision: snap.R(11)}) // generate .desktop file in the package baseDir baseDir := info.MountDir() err := os.MkdirAll(filepath.Join(baseDir, "meta", "gui"), 0755) c.Assert(err, IsNil) err = ioutil.WriteFile(filepath.Join(baseDir, "meta", "gui", "foobar.desktop"), mockDesktopFile, 0644) c.Assert(err, IsNil) err = wrappers.AddSnapDesktopFiles(info) c.Assert(err, IsNil) c.Assert(osutil.FileExists(expectedDesktopFilePath), Equals, true) c.Assert(s.mockUpdateDesktopDatabase.Calls(), DeepEquals, [][]string{ {"update-desktop-database", dirs.SnapDesktopFilesDir}, }) }