native_getcwd function
Get the pathname of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is NULL, an array is allocated with `malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary.
Implementation
ffi.Pointer<ffi.Int8> native_getcwd(
ffi.Pointer<ffi.Int8> buf,
int size,
) {
_getcwd ??= Libc().dylib.lookupFunction<
ffi.Pointer<ffi.Int8> Function(ffi.Pointer<ffi.Int8>, ffi.Uint64),
_dart_getcwd>('getcwd');
return _getcwd!(
buf,
size,
);
}