`Link.create` only works for directories on windows

example program:

import 'dart:io';

main() async {
  var  link = new Link('link.txt');
  await link.create('original.txt');

This will “succeed” on both linux and windows, but on windows it will create a directory symlink which doesn’t work (since its actually pointing at a file). You end up getting a permissions error if you try and open the symlink.

As far as I can tell windows has supported symlinks for files as well as directories for a while now (at least since vista), so the above should be able to work, although I am not sure how complex it would be to implement.

It looks like the windows file implementation assumes a directory, although this is not documented or validated.

Author: Fantashit

2 thoughts on “`Link.create` only works for directories on windows

  1. Ah gotcha. I’ll look into how difficult it would be to update the existing implementation and see if I can spare a few cycles to switch to real symlinks in the next week or so.

Comments are closed.