archiveDirectory method

File? archiveDirectory({
  1. required Directory directoryPackage,
  2. String? password,
  3. required Directory directoryOutPut,
  4. String fileSystemEntityIgnore = "",
})

Implementation

File? archiveDirectory({
  required Directory directoryPackage,
  String? password,
  required Directory directoryOutPut,
  String fileSystemEntityIgnore = "",
}) {
  if (Dart.isWeb) {
    return null;
  }
  final File file_pubspec =
      File(path.join(directoryPackage.path, "pubspec.yaml"));
  if (file_pubspec.existsSync() == false) {
    return null;
  }
  final Map yaml_code =
      (yaml.loadYaml(file_pubspec.readAsStringSync(), recover: true) as Map);
  return ArchiveGeneralLib.createArchiveZip(
    directory: directoryPackage,
    password: password,
    outPutFile: File(path.join(directoryOutPut.uri.toFilePath(),
        "${yaml_code["name"]}-${yaml_code["version"]}")),
    archiveGeneralLibOptions: ArchiveGeneralLibOptions(
      fileSystemEntityIgnore: """
.git
.dart_tool
$fileSystemEntityIgnore
""",
      isUseFileSystemEntityIgnore: true,
      isVerbose: false,
    ),
  );
}