readOptionalEntrySource static method

String? readOptionalEntrySource({
  1. required String appDir,
  2. required String relativePath,
})

Reads an optional entry only after its application-relative path has passed the same symlink confinement check as configured entries.

Implementation

static String? readOptionalEntrySource({
  required String appDir,
  required String relativePath,
}) {
  validatePathWithinRoot(root: appDir, relativePath: relativePath);
  final entry = File(p.join(appDir, relativePath));
  return entry.existsSync() ? entry.readAsStringSync() : null;
}