func listPackages() (list packages.AppletPackages, e error) { // List server only. if *listServer { return packages.ListDistant(logger, cdglobal.AppletsDirName+"/"+cdglobal.AppletsServerTag) } // Get applets dir. externalUserDir, e := packages.DirAppletsExternal(*listUserDir) if e != nil { return nil, e } // List local only. if *listLocal { return packages.ListFromDir(logger, externalUserDir, packages.TypeUser, packages.SourceApplet) } // List default (merged both). packs, e := packages.ListDownloadApplets(logger, externalUserDir) if e != nil { return nil, e } return packages.ListDownloadSort(packs), nil }
// ListDownloadApplets builds the list of downloadable user applets (installed or not). // func (d Data) ListDownloadApplets() (map[string]datatype.Appleter, error) { externalUserDir := globals.DirDockData(cdglobal.AppletsDirName) packs, e := packages.ListDownloadApplets(d.Log, externalUserDir) if e != nil { return nil, e } applets := docklist.Module() list := make(map[string]datatype.Appleter) for k, v := range packs { list[k] = &AppletDownload{ AppletPackage: *v, app: applets[k], } } return list, nil }