File tree Expand file tree Collapse file tree 1 file changed +28
-13
lines changed Expand file tree Collapse file tree 1 file changed +28
-13
lines changed Original file line number Diff line number Diff line change @@ -137,21 +137,36 @@ void AddNewInstallDlg::PopulateWithFilter(const std::function<bool (const versio
137
137
void AddNewInstallDlg::InstallSelected (wxCommandEvent&){
138
138
// get the selected item
139
139
auto item = versionsListCtrl->GetSelection ();
140
+ auto data = *(reinterpret_cast <version*>(versionsListCtrl->GetItemData (item)));
140
141
if (item.IsOk ()){
141
- auto & data = *(reinterpret_cast <version*>(versionsListCtrl->GetItemData (item)));
142
-
143
-
144
- // download the file
145
- #ifdef __APPLE__
146
-
147
- #elif defined _WIN32
148
-
149
- #elif __linux__
150
-
151
- #else
152
- #error This platform is not supported.
153
142
154
- #endif
143
+ thread th ([&]{
144
+ // download the file
145
+ string url = " https://download.unity3d.com/download_unity/" + data.hashcode +
146
+ #ifdef __APPLE__
147
+ " /UnityDownloadAssistant.dmg" ;
148
+ #elif defined _WIN32
149
+
150
+ #elif __linux__
151
+
152
+ #else
153
+ #error This platform is not supported.
154
+
155
+ #endif
156
+
157
+ auto r = cpr::Get (cpr::Url{url});
158
+
159
+ if (r.status_code != 200 ){
160
+ // TODO: post that download failed
161
+ throw runtime_error (" Unable to download installer" );
162
+ }
163
+ else {
164
+ // write the file to temp location
165
+ }
166
+ });
167
+ th.detach ();
168
+
169
+
155
170
}
156
171
else {
157
172
wxMessageBox (" Select a version" , " Error" , wxOK | wxICON_ERROR);
You can’t perform that action at this time.
0 commit comments