New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSystemCreateEvent.isDirectory returns wrong value when Link is created on Windows #35102

Open
sgrekhov opened this Issue Nov 8, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@sgrekhov
Contributor

sgrekhov commented Nov 8, 2018

When Link is created then FileSystemCreateEvent is fired with isDirectory property set to true. But Link is not a Directory, isDirectory should be false in this case. Example

import "dart:io";
import "dart:async";

main() async {
  Directory sandbox = Directory.systemTemp.createTempSync();
  Directory dir = new Directory(sandbox.path + Platform.pathSeparator + "dir");
  dir.createSync();
  File target = new File(sandbox.path + Platform.pathSeparator + "target");
  target.createSync();

  final eventCompleter = new Completer<FileSystemEvent>();
  var subscription;
  subscription = dir.watch().listen((FileSystemEvent event) {
      eventCompleter.complete(event);
      subscription.cancel();
  });
  Link link = new Link(dir.path + Platform.pathSeparator + "link");
  link.createSync(target.path);
  final event = await eventCompleter.future;
  print(event);
  print(event.isDirectory);

  sandbox.deleteSync(recursive: true);
}

Under Linux the code above produces

FileSystemCreateEvent('/tmp/HQLPTU/dir/link')
false

Tested on
Dart VM version: 2.1.0-dev.8.0 (Wed Oct 24 21:47:12 2018 +0200) on "windows_x64"
Dart VM version: 2.1.0-dev.9.2 (Unknown timestamp) on "linux_x64"

@sgrekhov sgrekhov changed the title from FileSystemCreateEvent.isDirectory returns wring value when Link is created on Windows to FileSystemCreateEvent.isDirectory returns wrong value when Link is created on Windows Nov 9, 2018

@kevmoo kevmoo added the area-library label Nov 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment