hasCustomPlatformImpl function

bool hasCustomPlatformImpl(
  1. String baseDir,
  2. String platform,
  3. String className
)

Whether Windows or Linux should get its OWN impl file instead of sharing src/Hybrid$className.cpp — driven entirely by what's actually on disk, not by annotation config, so both "keep everything in one shared file" and "diverge Windows and Linux" stay available as a plugin-author choice (some plugins want one file for easier maintenance when the logic really is identical; others want Windows and Linux to genuinely diverge — e.g. different threading primitives, platform intrinsics).

True only when $baseDir/$platform/src/Hybrid$className.cpp exists AND has moved past the auto-generated starter stub (no longer contains _implStubTodoMarker) — i.e. the plugin author actually started writing platform-specific code there. An untouched stub (or no file at all) means "keep sharing" — nitrogen never forces a plugin onto the separated shape.

Implementation

bool hasCustomPlatformImpl(String baseDir, String platform, String className) {
  final f = File(p.join(baseDir, platform, 'src', 'Hybrid$className.cpp'));
  if (!f.existsSync()) return false;
  return !f.readAsStringSync().contains(_implStubTodoMarker);
}