File tree 1 file changed +24
-1
lines changed
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
type firmware struct {
11
11
Path string
12
12
Name string
13
+ extra string
13
14
IsLoader bool
14
15
}
15
16
@@ -72,11 +73,33 @@ func GetCompatibleWith(name string) map[string][]firmware {
72
73
lowerPath , _ := filepath .Rel (root , path )
73
74
lowerPath = strings .ToLower (lowerPath )
74
75
_ , alreadyPopulated := files [folder ]
75
- if listAll || ((fw .MatchString (path ) || f .IsLoader ) && isPreferred (alreadyPopulated , lowerPath , knownBoards [name ])) {
76
+ if listAll && ! strings .HasPrefix (f .Name , "firmwares" ) {
77
+ files [folder ] = append (files [folder ], f )
78
+ }
79
+ if ! listAll && (fw .MatchString (path ) || f .IsLoader ) && isPreferred (alreadyPopulated , lowerPath , knownBoards [name ]) {
76
80
files [folder ] = append (files [folder ], f )
77
81
}
78
82
return nil
79
83
})
84
+
85
+ // check files and add information to fw.Name in case of name clashing
86
+ for k := range files {
87
+ for i := range files [k ] {
88
+ for j := range files [k ] {
89
+ if files [k ][i ].Name == files [k ][j ].Name && i != j {
90
+ files [k ][i ].extra = filepath .Base (files [k ][i ].Path )
91
+ }
92
+ }
93
+ }
94
+ }
95
+ for k := range files {
96
+ for i := range files [k ] {
97
+ if files [k ][i ].extra != "" {
98
+ files [k ][i ].Name = files [k ][i ].Name + " (" + files [k ][i ].extra + ")"
99
+ }
100
+ }
101
+ }
102
+
80
103
if err != nil {
81
104
return files
82
105
}
You can’t perform that action at this time.
0 commit comments