link function

void link(
  1. String from,
  2. String to
)

Make a link to FROM named TO.

Throws a PosixException if an error occurs.

Implementation

void link(
  String from,
  String to,
) {
  final cFrom = from.toNativeUtf8();
  final cTo = to.toNativeUtf8();

  _link ??= Libc().dylib.lookupFunction<
      ffi.Int32 Function(ffi.Pointer<Utf8>, ffi.Pointer<Utf8>),
      _dart_link>('link');
  final result = _link!(
    cFrom,
    cTo,
  );

  _throwIfErrno('symlink', result, cFrom, cTo);

  malloc
    ..free(cFrom)
    ..free(cTo);
}