File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010type firmware struct {
1111 Path string
1212 Name string
13+ extra string
1314 IsLoader bool
1415}
1516
@@ -72,11 +73,33 @@ func GetCompatibleWith(name string) map[string][]firmware {
7273 lowerPath , _ := filepath .Rel (root , path )
7374 lowerPath = strings .ToLower (lowerPath )
7475 _ , 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 ]) {
7680 files [folder ] = append (files [folder ], f )
7781 }
7882 return nil
7983 })
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+
80103 if err != nil {
81104 return files
82105 }
You can’t perform that action at this time.
0 commit comments