@@ -18,7 +18,6 @@ package sketch
18
18
import (
19
19
"crypto/md5"
20
20
"encoding/hex"
21
- "encoding/json"
22
21
"fmt"
23
22
"sort"
24
23
"strings"
@@ -38,23 +37,9 @@ type Sketch struct {
38
37
OtherSketchFiles paths.PathList // Sketch files that end in .ino other than main file
39
38
AdditionalFiles paths.PathList
40
39
RootFolderFiles paths.PathList // All files that are in the Sketch root
41
- Metadata * Metadata
42
40
Project * Project
43
41
}
44
42
45
- // Metadata is the kind of data associated to a project such as the connected board
46
- type Metadata struct {
47
- CPU BoardMetadata `json:"cpu,omitempty"`
48
- }
49
-
50
- // BoardMetadata represents the board metadata for the sketch
51
- type BoardMetadata struct {
52
- Fqbn string `json:"fqbn"`
53
- Name string `json:"name,omitempty"`
54
- Port string `json:"port,omitempty"`
55
- Protocol string `json:"protocol,omitempty"`
56
- }
57
-
58
43
var tr = i18n .Tr
59
44
60
45
// New creates an Sketch instance by reading all the files composing a sketch and grouping them
@@ -100,7 +85,6 @@ func New(path *paths.Path) (*Sketch, error) {
100
85
OtherSketchFiles : paths.PathList {},
101
86
AdditionalFiles : paths.PathList {},
102
87
RootFolderFiles : paths.PathList {},
103
- Metadata : new (Metadata ),
104
88
Project : & Project {},
105
89
}
106
90
@@ -170,9 +154,6 @@ func New(path *paths.Path) (*Sketch, error) {
170
154
sort .Sort (& sketch .OtherSketchFiles )
171
155
sort .Sort (& sketch .RootFolderFiles )
172
156
173
- if err := sketch .importMetadata (); err != nil {
174
- return nil , fmt .Errorf (tr ("importing sketch metadata: %s" ), err )
175
- }
176
157
return sketch , nil
177
158
}
178
159
@@ -197,46 +178,6 @@ func (s *Sketch) supportedFiles() (*paths.PathList, error) {
197
178
198
179
}
199
180
200
- // ImportMetadata imports metadata into the sketch from a sketch.json file in the root
201
- // path of the sketch.
202
- func (s * Sketch ) importMetadata () error {
203
- sketchJSON := s .FullPath .Join ("sketch.json" )
204
- if sketchJSON .NotExist () {
205
- // File doesn't exist, nothing to import
206
- return nil
207
- }
208
-
209
- content , err := sketchJSON .ReadFile ()
210
- if err != nil {
211
- return fmt .Errorf (tr ("reading sketch metadata %[1]s: %[2]s" ), sketchJSON , err )
212
- }
213
- var meta Metadata
214
- err = json .Unmarshal (content , & meta )
215
- if err != nil {
216
- if s .Metadata == nil {
217
- s .Metadata = new (Metadata )
218
- }
219
- return fmt .Errorf (tr ("encoding sketch metadata: %s" ), err )
220
- }
221
- s .Metadata = & meta
222
- return nil
223
- }
224
-
225
- // ExportMetadata writes sketch metadata into a sketch.json file in the root path of
226
- // the sketch
227
- func (s * Sketch ) ExportMetadata () error {
228
- d , err := json .MarshalIndent (& s .Metadata , "" , " " )
229
- if err != nil {
230
- return fmt .Errorf (tr ("decoding sketch metadata: %s" ), err )
231
- }
232
-
233
- sketchJSON := s .FullPath .Join ("sketch.json" )
234
- if err := sketchJSON .WriteFile (d ); err != nil {
235
- return fmt .Errorf (tr ("writing sketch metadata %[1]s: %[2]s" ), sketchJSON , err )
236
- }
237
- return nil
238
- }
239
-
240
181
// GetProfile returns the requested profile or nil if the profile
241
182
// is not found.
242
183
func (s * Sketch ) GetProfile (profileName string ) * Profile {
0 commit comments