resolveAgentSdkServerSourceFor function

String resolveAgentSdkServerSourceFor({
  1. required String executableDir,
})

The folder an install takes the server's source from: the first of agentSdkServerSourceCandidates holding all three source files, else the packaged location, so a failure names where the source was expected.

Implementation

String resolveAgentSdkServerSourceFor({required String executableDir}) {
  final sep = Platform.pathSeparator;
  final candidates = agentSdkServerSourceCandidates(
    executableDir: executableDir,
  );
  for (final dir in candidates) {
    if (agentSdkServerSourceFiles.every(
      (name) => File('$dir$sep$name').existsSync(),
    )) {
      return dir;
    }
  }
  return candidates.first;
}