func (s *binariesTestSuite) TestAddSnapBinariesAndRemove(c *C) { info := snaptest.MockSnap(c, packageHello, &snap.SideInfo{Revision: snap.R(11)}) err := wrappers.AddSnapBinaries(info) c.Assert(err, IsNil) link := filepath.Join(s.tempdir, "/snap/bin/hello-snap.hello") target, err := os.Readlink(link) c.Assert(err, IsNil) c.Check(target, Equals, "/usr/bin/snap") err = wrappers.RemoveSnapBinaries(info) c.Assert(err, IsNil) c.Check(osutil.FileExists(link), Equals, false) }
func removeGeneratedWrappers(s *snap.Info, meter progress.Meter) error { err1 := wrappers.RemoveSnapBinaries(s) if err1 != nil { logger.Noticef("Cannot remove binaries for %q: %v", s.Name(), err1) } err2 := wrappers.RemoveSnapServices(s, meter) if err2 != nil { logger.Noticef("Cannot remove services for %q: %v", s.Name(), err2) } err3 := wrappers.RemoveSnapDesktopFiles(s) if err3 != nil { logger.Noticef("Cannot remove desktop files for %q: %v", s.Name(), err3) } return firstErr(err1, err2, err3) }