isNotEmptyCode function

bool isNotEmptyCode(
  1. int errorCode
)

Implementation

bool isNotEmptyCode(int errorCode) {
  // Ubuntu:
  // FileSystemException: Deletion failed, path = '...'
  // (OS Error: Directory not empty, errno = 39)
  //
  // MacOS:
  // FileSystemException: Deletion failed, path = '...'
  // (OS Error: Directory not empty, errno = 66)
  //
  // Windows:
  // FileSystemException: Deletion failed, path = '...'
  // (OS Error: The directory is not empty., errno = 145)

  if (Platform.isWindows && errorCode == WindowsErrors.dirNotEmpty) {
    return true;
  }

  if ((Platform.isMacOS || Platform.isIOS) &&
      errorCode == DarwinErrors.directoryNotEmpty) {
    return true;
  }

  // assuming we are on *nix
  return errorCode == LinuxErrors.directoryNotEmpty;
}