installFromDirectoryFresh method

Directory? installFromDirectoryFresh({
  1. required Directory directoryPackage,
  2. String? password,
  3. bool deleteIfExist = true,
  4. Directory? directoryOutPut,
  5. String fileSystemEntityIgnore = "",
})

Implementation

Directory? installFromDirectoryFresh({
  required Directory directoryPackage,
  String? password,
  bool deleteIfExist = true,
  Directory? directoryOutPut,
  String fileSystemEntityIgnore = "",
}) {
  final res = archiveDirectory(
    directoryPackage: directoryPackage,
    password: password,
    directoryOutPut: Directory(
        path.join((directoryOutPut ?? Directory.current).path, "temp")),
    fileSystemEntityIgnore: fileSystemEntityIgnore,
  );
  if (res == null) {
    return null;
  }
  try {
    final installed_dir = installFromArchive(
      archivedFile: res,
      password: password,
      fileSystemEntityIgnore: fileSystemEntityIgnore,
      deleteIfExist: deleteIfExist,
    );
    res.deleteSync(recursive: true);
    return installed_dir;
  } catch (e) {
    res.deleteSync(recursive: true);
    rethrow;
  }
}