@@ -95,15 +95,23 @@ 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 () == "" && fqbnArg .String () == "" {
102
+ inst , profile = instance .CreateAndInitWithProfile (sk .Project .DefaultProfile , sketchPath , true )
103
+ } else {
104
+ inst , profile = instance .CreateAndInitWithProfile (profileArg .Get (), sketchPath , false )
105
+ }
106
+
99
107
if fqbnArg .String () == "" {
100
108
fqbnArg .Set (profile .GetFqbn ())
101
109
}
102
110
103
- fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , instance , sk )
111
+ fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , inst , sk )
104
112
105
113
userFieldRes , err := upload .SupportedUserFields (context .Background (), & rpc.SupportedUserFieldsRequest {
106
- Instance : instance ,
114
+ Instance : inst ,
107
115
Fqbn : fqbn ,
108
116
Protocol : port .Protocol ,
109
117
})
@@ -120,7 +128,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
120
128
}
121
129
122
130
// FIXME: Here we must not access package manager...
123
- pme , release := commands .GetPackageManagerExplorer (& rpc.UploadRequest {Instance : instance })
131
+ pme , release := commands .GetPackageManagerExplorer (& rpc.UploadRequest {Instance : inst })
124
132
platform := pme .FindPlatform (& packagemanager.PlatformReference {
125
133
Package : split [0 ],
126
134
PlatformArchitecture : split [1 ],
@@ -154,7 +162,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
154
162
155
163
stdOut , stdErr , stdIOResult := feedback .OutputStreams ()
156
164
req := & rpc.UploadRequest {
157
- Instance : instance ,
165
+ Instance : inst ,
158
166
Fqbn : fqbn ,
159
167
SketchPath : path ,
160
168
Port : port ,
0 commit comments