@@ -95,17 +95,25 @@ func runUploadCommand(command *cobra.Command, args []string) {
95
95
feedback .Fatal (tr ("Error during Upload: %v" , err ), feedback .ErrGeneric )
96
96
}
97
97
98
- instance , profile := instance .CreateAndInitWithProfile (profileArg .Get (), sketchPath )
98
+ var inst * rpc.Instance
99
+ var profile * rpc.Profile
100
+
101
+ if profileArg .Get () == "" {
102
+ inst , profile = instance .CreateAndInitWithProfile (sk .Project .DefaultProfile , sketchPath )
103
+ } else {
104
+ inst , profile = instance .CreateAndInitWithProfile (profileArg .Get (), sketchPath )
105
+ }
106
+
99
107
if fqbnArg .String () == "" {
100
108
fqbnArg .Set (profile .GetFqbn ())
101
109
}
102
110
103
111
defaultFQBN := sk .GetDefaultFQBN ()
104
112
defaultAddress , defaultProtocol := sk .GetDefaultPortAddressAndProtocol ()
105
- fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , instance , defaultFQBN , defaultAddress , defaultProtocol )
113
+ fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , inst , defaultFQBN , defaultAddress , defaultProtocol )
106
114
107
115
userFieldRes , err := upload .SupportedUserFields (context .Background (), & rpc.SupportedUserFieldsRequest {
108
- Instance : instance ,
116
+ Instance : inst ,
109
117
Fqbn : fqbn ,
110
118
Protocol : port .Protocol ,
111
119
})
@@ -122,7 +130,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
122
130
}
123
131
124
132
// FIXME: Here we must not access package manager...
125
- pme , release := commands .GetPackageManagerExplorer (& rpc.UploadRequest {Instance : instance })
133
+ pme , release := commands .GetPackageManagerExplorer (& rpc.UploadRequest {Instance : inst })
126
134
platform := pme .FindPlatform (& packagemanager.PlatformReference {
127
135
Package : split [0 ],
128
136
PlatformArchitecture : split [1 ],
@@ -156,7 +164,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
156
164
157
165
stdOut , stdErr , stdIOResult := feedback .OutputStreams ()
158
166
req := & rpc.UploadRequest {
159
- Instance : instance ,
167
+ Instance : inst ,
160
168
Fqbn : fqbn ,
161
169
SketchPath : path ,
162
170
Port : port ,
0 commit comments