symlink static method

bool symlink(
  1. String target,
  2. String link
)

Creates the symbolic link to the target and returns true if the operation was successful; otherwise false.

If target does not exists returns false.

IMPORTANT: On the Windows platform, this will only work with directories.

Implementation

static bool symlink(String target, String link) {
  target = FilePath.expand(target);
  link = FilePath.expand(link);
  if (_isWindows) {
    if (!testfile(target, 'directory')!) {
      return false;
    }
  } else {
    if (!testfile(target, 'exists')!) {
      return false;
    }
  }

  final symlink = Link(link);
  try {
    symlink.createSync(target);
  } catch (e) {
    return false;
  }

  return true;
}