@@ -154,7 +154,8 @@ func StartApp(
154154 if ! yield (StreamMessage {progress : & Progress {Name : "preparing" , Progress : 0.0 }}) {
155155 return
156156 }
157- if appToStart .MainSketchPath != nil {
157+
158+ if _ , ok := appToStart .GetSketchPath (); ok {
158159 if ! yield (StreamMessage {progress : & Progress {Name : "sketch compiling and uploading" , Progress : 0.0 }}) {
159160 return
160161 }
@@ -175,7 +176,7 @@ func StartApp(
175176 return
176177 }
177178 provisionStartProgress := float32 (0.0 )
178- if appToStart . MainSketchPath != nil {
179+ if _ , ok := appToStart . GetSketchPath (); ok {
179180 provisionStartProgress = 10.0
180181 }
181182
@@ -402,7 +403,7 @@ func stopAppWithCmd(ctx context.Context, docker command.Cli, app app.ArduinoApp,
402403 }
403404 })
404405
405- if app . MainSketchPath != nil {
406+ if _ , ok := app . GetSketchPath (); ok {
406407 // Before stopping the microcontroller we want to make sure that the app was running.
407408 appStatus , err := getAppStatus (ctx , docker , app )
408409 if err != nil {
@@ -1150,9 +1151,12 @@ func compileUploadSketch(
11501151 defer func () {
11511152 _ , _ = srv .Destroy (ctx , & rpc.DestroyRequest {Instance : inst })
11521153 }()
1153- sketchPath := arduinoApp .MainSketchPath .String ()
1154+ sketchPath , ok := arduinoApp .GetSketchPath ()
1155+ if ! ok {
1156+ return fmt .Errorf ("no sketch path found in the Arduino app" )
1157+ }
11541158 buildPath := arduinoApp .SketchBuildPath ().String ()
1155- sketchResp , err := srv .LoadSketch (ctx , & rpc.LoadSketchRequest {SketchPath : sketchPath })
1159+ sketchResp , err := srv .LoadSketch (ctx , & rpc.LoadSketchRequest {SketchPath : sketchPath . String () })
11561160 if err != nil {
11571161 return err
11581162 }
@@ -1163,7 +1167,7 @@ func compileUploadSketch(
11631167 }
11641168 initReq := & rpc.InitRequest {
11651169 Instance : inst ,
1166- SketchPath : sketchPath ,
1170+ SketchPath : sketchPath . String () ,
11671171 Profile : profile ,
11681172 }
11691173
@@ -1203,7 +1207,7 @@ func compileUploadSketch(
12031207 compileReq := rpc.CompileRequest {
12041208 Instance : inst ,
12051209 Fqbn : "arduino:zephyr:unoq" ,
1206- SketchPath : sketchPath ,
1210+ SketchPath : sketchPath . String () ,
12071211 BuildPath : buildPath ,
12081212 Jobs : 2 ,
12091213 }
@@ -1229,12 +1233,12 @@ func compileUploadSketch(
12291233 slog .Info ("Used library " + lib .GetName () + " (" + lib .GetVersion () + ") in " + lib .GetInstallDir ())
12301234 }
12311235
1232- if err := uploadSketchInRam (ctx , w , srv , inst , sketchPath , buildPath ); err != nil {
1236+ if err := uploadSketchInRam (ctx , w , srv , inst , sketchPath . String () , buildPath ); err != nil {
12331237 slog .Warn ("failed to upload in ram mode, trying to configure the board in ram mode, and retry" , slog .String ("error" , err .Error ()))
12341238 if err := configureMicroInRamMode (ctx , w , srv , inst ); err != nil {
12351239 return err
12361240 }
1237- return uploadSketchInRam (ctx , w , srv , inst , sketchPath , buildPath )
1241+ return uploadSketchInRam (ctx , w , srv , inst , sketchPath . String () , buildPath )
12381242 }
12391243 return nil
12401244}
0 commit comments