()
| 455 | } |
| 456 | |
| 457 | function configureCrashReporter(): void { |
| 458 | let crashReporterDirectory = args['crash-reporter-directory']; |
| 459 | let submitURL = ''; |
| 460 | if (crashReporterDirectory) { |
| 461 | crashReporterDirectory = path.normalize(crashReporterDirectory); |
| 462 | |
| 463 | if (!path.isAbsolute(crashReporterDirectory)) { |
| 464 | console.error(`The path '${crashReporterDirectory}' specified for --crash-reporter-directory must be absolute.`); |
| 465 | app.exit(1); |
| 466 | } |
| 467 | |
| 468 | if (!fs.existsSync(crashReporterDirectory)) { |
| 469 | try { |
| 470 | fs.mkdirSync(crashReporterDirectory, { recursive: true }); |
| 471 | } catch (error) { |
| 472 | console.error(`The path '${crashReporterDirectory}' specified for --crash-reporter-directory does not seem to exist or cannot be created.`); |
| 473 | app.exit(1); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | // Crashes are stored in the crashDumps directory by default, so we |
| 478 | // need to change that directory to the provided one |
| 479 | console.log(`Found --crash-reporter-directory argument. Setting crashDumps directory to be '${crashReporterDirectory}'`); |
| 480 | app.setPath('crashDumps', crashReporterDirectory); |
| 481 | } |
| 482 | |
| 483 | // Otherwise we configure the crash reporter from product.json |
| 484 | else { |
| 485 | const appCenter = product.appCenter; |
| 486 | if (appCenter) { |
| 487 | const isWindows = (process.platform === 'win32'); |
| 488 | const isLinux = (process.platform === 'linux'); |
| 489 | const isDarwin = (process.platform === 'darwin'); |
| 490 | const crashReporterId = argvConfig['crash-reporter-id']; |
| 491 | const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; |
| 492 | if (crashReporterId && uuidPattern.test(crashReporterId)) { |
| 493 | if (isWindows) { |
| 494 | switch (process.arch) { |
| 495 | case 'x64': |
| 496 | submitURL = appCenter['win32-x64']; |
| 497 | break; |
| 498 | case 'arm64': |
| 499 | submitURL = appCenter['win32-arm64']; |
| 500 | break; |
| 501 | } |
| 502 | } else if (isDarwin) { |
| 503 | if (product.darwinUniversalAssetId) { |
| 504 | submitURL = appCenter['darwin-universal']; |
| 505 | } else { |
| 506 | switch (process.arch) { |
| 507 | case 'x64': |
| 508 | submitURL = appCenter['darwin']; |
| 509 | break; |
| 510 | case 'arm64': |
| 511 | submitURL = appCenter['darwin-arm64']; |
| 512 | break; |
| 513 | } |
| 514 | } |
no test coverage detected
searching dependent graphs…