File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ type Sketch struct {
39
39
AdditionalFiles paths.PathList
40
40
RootFolderFiles paths.PathList // All files that are in the Sketch root
41
41
Metadata * Metadata
42
+ Project * Project
42
43
}
43
44
44
45
// Metadata is the kind of data associated to a project such as the connected board
@@ -93,6 +94,15 @@ func New(path *paths.Path) (*Sketch, error) {
93
94
Metadata : new (Metadata ),
94
95
}
95
96
97
+ projectFile := path .Join ("sketch.yml" )
98
+ if projectFile .Exist () {
99
+ prj , err := LoadProjectFile (projectFile )
100
+ if err != nil {
101
+ return nil , fmt .Errorf ("%s %w" , tr ("error loading project file:" ), err )
102
+ }
103
+ sketch .Project = prj
104
+ }
105
+
96
106
err := sketch .checkSketchCasing ()
97
107
if e , ok := err .(* InvalidSketchFolderNameError ); ok {
98
108
return nil , e
@@ -218,6 +228,12 @@ func (s *Sketch) ExportMetadata() error {
218
228
return nil
219
229
}
220
230
231
+ // GetProfile returns the requested profile or nil if the profile
232
+ // is not found.
233
+ func (s * Sketch ) GetProfile (profileName string ) * Profile {
234
+ return s .Project .Profiles [profileName ]
235
+ }
236
+
221
237
// checkSketchCasing returns an error if the casing of the sketch folder and the main file are different.
222
238
// Correct:
223
239
// MySketch/MySketch.ino
You can’t perform that action at this time.
0 commit comments