writeAll method
Writes all files, keyed by bundle-relative path.
When checkOnly is true the filesystem is not changed; the returned
paths identify files that would be written.
expectedSources maps paths to the text the caller read. A mismatch fails
the call instead of writing or reporting against stale content.
Implementation
Future<OkfWriteResult> writeAll(
String rootPath,
Map<String, String> files, {
bool checkOnly = false,
Map<String, String> expectedSources = const <String, String>{},
}) async {
if (checkOnly) {
final root = await _validatedRoot(rootPath, createIfMissing: false);
return _writeAll(
root,
_normalizeFiles(files),
expectedSources,
checkOnly: true,
);
}
await _createRoot(rootPath);
return OkfBundleLock.write(rootPath, () async {
final root = await _validatedRoot(rootPath, createIfMissing: true);
return _writeAll(
root,
_normalizeFiles(files),
expectedSources,
checkOnly: false,
);
});
}