prepare method

Future<void> prepare()

Makes the directory the user's alone when missing, then checks it: owned by this user with no access for anyone else (POSIX: mode 0700; Windows: the inheritance cut and only the user and SYSTEM granted). A directory of someone else, or one others can read, is refused.

Implementation

Future<void> prepare() async {
  final dir = Directory(directory);
  if (!await dir.exists()) {
    await dir.create(recursive: true);
    if (Platform.isWindows) {
      await _windowsRestrict();
    } else {
      await _run('chmod', ['700', directory]);
    }
  }
  await check();
}