MCPcopy
hub / github.com/microsoft/vscode / configureCrashReporter

Function configureCrashReporter

src/main.ts:457–547  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

455}
456
457function 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 }

Callers 1

main.tsFile · 0.70

Calls 12

BooleanEnum · 0.85
normalizeMethod · 0.65
isAbsoluteMethod · 0.65
errorMethod · 0.65
exitMethod · 0.65
logMethod · 0.65
indexOfMethod · 0.65
pushMethod · 0.65
spliceMethod · 0.65
startMethod · 0.65
testMethod · 0.45
concatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…