prepare method
Creates or reopens the stable temporary directory for key.
Implementation
Future<String> prepare(String key) async {
_validateKey(key);
try {
final canonicalRoot = await _prepareDirectory(
Directory(root),
expectedParent: null,
);
return (await _prepareDirectory(
Directory(p.join(canonicalRoot.path, key)),
expectedParent: canonicalRoot.path,
)).path;
} on Object catch (error, stackTrace) {
try {
await release(key);
} on Object {
// Preserve the preparation failure, which explains why the directory
// is unsafe or unusable. Cleanup is retried by later lifecycle work.
}
Error.throwWithStackTrace(error, stackTrace);
}
}