Skip to content

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

@sgrekhov

Description

@sgrekhov

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"

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-iotype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions