unArchiveValidator function

String unArchiveValidator(
  1. File file,
  2. Directory dir, [
  3. bool? isWritable,
  4. List<String> extAllows = basicArchiveExtAllows,
])

Implementation

String unArchiveValidator(
  File file,
  Directory dir, [
  bool? isWritable, // isDirWriteable
  List<String> extAllows = basicArchiveExtAllows,
]) {
  final List<String> errors = [];

  if (!file.existsSync()) errors.add('not found. ${file.path}');
  isWritable ??= isDirWritable(dir);
  if (!isWritable) errors.add('not writable dir, ${dir.path}');

  final isAllowType = isAllowArchiveType(file.path, extAllows);
  if (!isAllowType) errors.add('not support type, ${file.path}');

  return errors.join(semicolonDelimiter);
}