locateAndroidServerSources function

Directory? locateAndroidServerSources({
  1. String? scriptPath,
})

The server's Java sources inside glint's package, found by walking up from the running script; null when this install has none.

Implementation

Directory? locateAndroidServerSources({String? scriptPath}) {
  Directory dir;
  try {
    dir = File(scriptPath ?? Platform.script.toFilePath()).parent;
  } catch (_) {
    dir = Directory.current;
  }
  for (var i = 0; i < 6; i++) {
    final src = Directory('${dir.path}/native/android_server/src');
    if (src.existsSync()) return src;
    final parent = dir.parent;
    if (parent.path == dir.path) break;
    dir = parent;
  }
  return null;
}