| 347 | } |
| 348 | |
| 349 | bool beginUploadTarget(File &file, const String &filename) { |
| 350 | if (uploadFolder == "/") uploadFolder = ""; |
| 351 | if (!update) { |
| 352 | launcherConsolePrintf("File: %s/%s\n", uploadFolder.c_str(), filename.c_str()); |
| 353 | String fullPath = uploadFolder + "/" + filename; |
| 354 | String dirPath = fullPath.substring(0, fullPath.lastIndexOf("/")); |
| 355 | if (dirPath.length() > 0) createDirRecursive(dirPath); |
| 356 | file = SDM.open(fullPath, "w"); |
| 357 | return static_cast<bool>(file); |
| 358 | } |
| 359 | |
| 360 | LauncherUpdateTarget target; |
| 361 | if (launcherUpdateTargetFromCommand(command, target) && launcherUpdateBegin(target, file_size)) { |
| 362 | prog_handler = target == LAUNCHER_UPDATE_APP ? 0 : 1; |
| 363 | progressHandler(0, file_size); |
| 364 | return true; |
| 365 | } |
| 366 | displayRedStripe("FAIL 365: " + String(launcherUpdateLastError())); |
| 367 | launcherDelayMs(3000); |
| 368 | return false; |
| 369 | } |
| 370 | |
| 371 | bool finishUploadTarget(File &file) { |
| 372 | if (!update) { |
no test coverage detected