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

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
harryzcy committed Apr 2, 2021
1 parent 2a5ca26 commit 0808558
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions internal/macapp/macapp.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package macapp

import (
"io/fs"
"io/ioutil"
"os"
"os/user"
"path/filepath"
Expand Down Expand Up @@ -54,17 +52,17 @@ func GetAllApplications(dirs []string) ([]Application, error) {
}

for _, dir := range dirs {
files, err := ioutil.ReadDir(dir)
entries, err := os.ReadDir(dir)
if err != nil {
if os.IsNotExist(err) {
continue
}
return nil, err
}

for _, f := range files {
if strings.HasSuffix(f.Name(), ".app") {
app := checkApplication(dir, f)
for _, entry := range entries {
if strings.HasSuffix(entry.Name(), ".app") {
app := checkApplication(dir, entry)
applications = append(applications, app)
}
}
Expand All @@ -73,10 +71,10 @@ func GetAllApplications(dirs []string) ([]Application, error) {
return applications, nil
}

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

app.Architectures, _ = localcheck.GetArchitectures(app.Path)
Expand Down

0 comments on commit 0808558

Please sign in to comment.