@@ -19,6 +19,7 @@ import (
19
19
"context"
20
20
"os"
21
21
22
+ "github.com/arduino/arduino-cli/arduino/sketch"
22
23
"github.com/arduino/arduino-cli/cli/arguments"
23
24
"github.com/arduino/arduino-cli/cli/errorcodes"
24
25
"github.com/arduino/arduino-cli/cli/feedback"
@@ -76,10 +77,27 @@ func runUploadCommand(command *cobra.Command, args []string) {
76
77
if len (args ) > 0 {
77
78
path = args [0 ]
78
79
}
79
-
80
80
sketchPath := arguments .InitSketchPath (path )
81
- sk := arguments .NewSketch (sketchPath )
82
- discoveryPort := port .GetDiscoveryPort (instance , sk )
81
+
82
+ // .pde files are still supported but deprecated, this warning urges the user to rename them
83
+ if files := sketch .CheckForPdeFiles (sketchPath ); len (files ) > 0 && importDir == "" && importFile == "" {
84
+ feedback .Error (tr ("Sketches with .pde extension are deprecated, please rename the following files to .ino:" ))
85
+ for _ , f := range files {
86
+ feedback .Error (f )
87
+ }
88
+ }
89
+
90
+ sk , err := sketch .New (sketchPath )
91
+ if err != nil && importDir == "" && importFile == "" {
92
+ feedback .Errorf (tr ("Error during Upload: %v" ), err )
93
+ os .Exit (errorcodes .ErrGeneric )
94
+ }
95
+
96
+ discoveryPort , err := port .GetPort (instance , sk )
97
+ if err != nil {
98
+ feedback .Errorf (tr ("Error during Upload: %v" ), err )
99
+ os .Exit (errorcodes .ErrGeneric )
100
+ }
83
101
84
102
if fqbn .String () == "" && sk != nil && sk .Metadata != nil {
85
103
// If the user didn't specify an FQBN and a sketch.json file is present
0 commit comments