Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Continue to check other apps on error
Browse files Browse the repository at this point in the history
  • Loading branch information
harryzcy committed Mar 28, 2021
1 parent 41388bd commit 28e1f84
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions internal/macapp/macapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ func GetAllApplications(dirs []string) ([]Application, error) {

for _, f := range files {
if strings.HasSuffix(f.Name(), ".app") {
app, err := checkApplication(dir, f)
if err != nil {
return nil, err
}
app := checkApplication(dir, f)
applications = append(applications, app)
}
}
Expand All @@ -75,28 +72,19 @@ func GetAllApplications(dirs []string) ([]Application, error) {
return applications, nil
}

func checkApplication(dir string, f fs.FileInfo) (Application, error) {
func checkApplication(dir string, f fs.FileInfo) Application {
app := Application{
Name: strings.TrimSuffix(f.Name(), ".app"),
Path: filepath.Join(dir, f.Name()),
}

var err error
app.Architectures, err = localcheck.GetArchitectures(app.Path)
if err != nil {
return Application{}, err
}
app.Architectures, _ = localcheck.GetArchitectures(app.Path)

info, err := remotecheck.GetInfo(app.Name)
if err == remotecheck.ErrNotFound {
return app, nil
}
if err != nil {
return Application{}, err
if err == nil {
app.Website = info.Website
app.ArmSupport = info.ArmSupport
}

app.Website = info.Website
app.ArmSupport = info.ArmSupport

return app, nil
return app
}

0 comments on commit 28e1f84

Please sign in to comment.