updateCMakeNitroNative function

String updateCMakeNitroNative(
  1. String content,
  2. String newPath
)

Replaces the set(NITRO_NATIVE "...") line in content with newPath. Returns the updated content. If no such line exists, returns content unchanged. Idempotent — running twice produces the same result, no duplicates.

Implementation

String updateCMakeNitroNative(String content, String newPath) {
  return content.replaceFirst(
    RegExp(r'set\(NITRO_NATIVE "[^"]*"\)'),
    'set(NITRO_NATIVE "$newPath")',
  );
}